[Question]
  [
My little kid has a toy like this:
[![Stacked](https://i.stack.imgur.com/lghyLm.jpg)](https://i.stack.imgur.com/lghyLm.jpg)
This toy consists of 10 stackable little buckets, that we are going to number from 1 (the smallest one) to 10 (the biggest one). Sometimes he makes small piles and the toy ends up like this:
[![Scattered](https://i.stack.imgur.com/n43Knm.jpg)](https://i.stack.imgur.com/n43Knm.jpg)
We can represent schematically the piles like this:
```
      1  6
4  9  2  7
5  10 3  8
----------  <-- Floor
1  2  3  4  <-- Pile #
```
Or, put it another way:
```
[[4,5],[9,10],[1,2,3],[6,7,8]]
```
This set of bucket piles is easily restackable to rebuild the original set (the first image) just by consecutively placing piles of smaller buckets inside piles of bigger buckets:
```
                             1                            1  6
                             2                            2  7
      1  6                   3        6                   3  8
4  9  2  7                   4  9     7                   4  9
5  10 3  8                   5  10    8                   5  10
---------- > [Pile 3 to 1] > ---------- > [Pile 4 to 2] > ---------- > [Pile 1 to 2] > Done!
1  2  3  4                   1  2  3  4                   1  2  3  4
```
Nonetheless, sometimes my kid tries to build towers, or throws buckets away, and the piles end up being inconsistent and the original set cannot be rebuild just by placing one pile inside another. Examples of this:
```
[[1,3,2],[4]] (the kid tried to build a tower by placing a bigger bucket
               over a smaller one, we would need to reorder the buckets
               first)
[[1,3,4],[2]] (the kid left aside an unordered bucket, we would need to remove
               bucket #1 from pile #1 before restacking)
[[1,2,3],[5]] (the kid lost a bucket, we need to find it first)
```
### Challenge
Given a list of lists of integers representing a set of bucket piles, return a truthy value if the lists represent an easily restackable set of piles, or falsey in any other case.
* Input will be given as a list of lists of integers, representing the buckets from top to bottom for each stack.
* There won't be empty starting piles (you won't get `[[1,2,3],[],[4,5]]` as input).
* The total number of buckets can be any within a reasonable integer range.
* My kid only has one set of buckets so there won't be duplicate elements.
* You can select any two consistent (and coherent) values for truthy or falsey.
* The buckets will be labelled from #1 to #N, being `N` the largest integer in the lists of integers. My kid still does not know the concept of zero.
* You may receive the input in any reasonable format as long as it represents a set of piles of buckets. Just specify it in your answer if you change the way you receive the input.
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so may the shortest program/function for each language win!
### Examples
```
Input:  [[4,5],[9,10],[1,2,3],[6,7,8]]
Output: Truthy
Input:  [[6,7,8,9,10],[1],[2],[3,4,5],[11,12,13]]
Output: Truthy
Input:  [[2,3,4],[1],[5,6,7]]
Output: Truthy
Input:  [[1,2],[5,6],[7,8,9]]
Output: Falsey (buckets #3 and #4 are missing)
Input:  [[2,3,4],[5,6,7]]
Output: Falsey (bucket #1 is missing)
Input:  [[1,3,4],[5,7],[2,6]]
Output: Falsey (non-restackable piles)
Input:  [[1,4,3],[2],[5,6]]
Output: Falsey (one of the piles is a tower)
```
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~6~~ 5 bytes
*Thanks to @Lynn for saving 1 byte.*
```
ṢFµJ⁼
```
[Try it online!](https://tio.run/##y0rNyan8///hzkVuh7Z6PWrc8/9w@6OmNf//RysoREeb6JjG6kRb6hgaAClDHSMdYyBtpmOuYxEbq8PFBVIC5unAlACxERAb60B0GhrqGBrpGBrDVQNN0DGBKjTVAeoFySigSMGFwaJASyFiQBJsEZIMTL05yFagCoSMCdihMJ2xsQA "Jelly – Try It Online") (comes with test-suite footer)
### Explanation
```
ṢFµJ⁼    Main link. Argument: piles
Ṣ          Sort the piles by the size of the top bucket.
 F         Stack the piles, putting the left one to the top.
   J       See what a full pile with this many buckets would look like.
    ⁼      See if that looks like the pile you built.
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~53~~ 52 bytes
*Thanks for the byte xnor*
```
lambda x:sum(sorted(x),[0])==range(len(sum(x,[]))+1)
```
[Try it online!](https://tio.run/##XY7NDoJADITvPgXHbZwDXcC/hCdZ94AB1AQWApjg068VJAYObZN@M9O27@HROO3L9OqrrL7lWTBe@let@qYbilyNBBNaStMuc/dCVYVTXzrCWKI9k2@7pxuCUhkTI7EwZ3Aog6ERyTzgiJO1tPvrphUWnZSWijDbmcEaHK0tkoX4p04gAWssx2Ygfcre4tmdiE@uiWyD4@nVJcOS/wA "Python 2 – Try It Online")
[Answer]
## JavaScript (ES6), ~~59~~ 58 bytes
```
a=>!(a.sort((a,[b])=>a[i=0]-b)+'').split`,`.some(v=>v-++i)
```
### Explanation
```
a=>                                                        // given a 2D-array 'a'
     a.sort((a,[b])=>a[i=0]-b)                             // sort by first item
                              +''                          // flatten
    (                            ).split`,`                // split again
                                           .some(v=>v-++i) // i such that a[i] != i+1?
   !                                                       // true if none was found
```
### Test cases
```
let f =
a=>!(a.sort((a,[b])=>a[i=0]-b)+'').split`,`.some(v=>v-++i)
// truthy
console.log(f([[4,5],[9,10],[1,2,3],[6,7,8]]))
console.log(f([[6,7,8,9,10],[1],[2],[3,4,5],[11,12,13]]))
console.log(f([[2,3,4],[1],[5,6,7]]))
// falsy
console.log(f([[1,2],[5,6],[7,8,9]]))
console.log(f([[2,3,4],[5,6,7]]))
console.log(f([[1,3,4],[5,7],[2,6]]))
console.log(f([[1,4,3],[2],[5,6]]))
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 4 bytes
```
{˜āQ
```
[Try it online!](https://tio.run/##MzBNTDJM/f@/@vScI42B//9HRxvqKBjF6ihEm@oomIFocx0FCx0Fy9hYAA "05AB1E – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), 54 bytes
```
import Data.List
f l=(sort l>>=id)==[1..length$l>>=id]
```
[Try it online!](https://tio.run/##VY7LDoIwEEX3fAULFpBMiOUhmlhWLvmDpotGijaWirR@fx0oxLiYR8/c25mHsE@ptfdqnF6zi6/CibxT1kVDrGlqF6bblqo@o5SRPNfS3N0jCYz7UShDrXx/pLnJdJai78wlWYQNz1Azzcq4fBRTPHjGKqg5sDOQAxYCBZRYj9DAifOIhQ72MUaBUUJwEQKkAFKuSnRCtYlqQN8f/RHcEd6Y1783uuuaZQlOA63We3YHj/wX "Haskell – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), 37 bytes
```
import Data.List
(<[1..]).concat.sort
```
[Try it online!](https://tio.run/##VY7LDoMgEEX3foWLLjSZkOKjtom66tI/ICyIxZRU0Ar9fjqKpuliHtw5l5mnsC85jt4rPU@Li@/CCdIp66KhSWpGCeEp6SfTC0csAl4LZRor3x9pepksUjw6U59WsOJp2zbzoowjWszx4BkroOTAbkDPWChkkGO9QAVXziMWOjjGGBlGDsFFKdAMaL6R6IRih0pA35/6U3BHeGPe/t7Vg6vWJTgNarHdczh45L8 "Haskell – Try It Online")
Checks whether the concatenated sorted list is lexicographically smaller than the infinite list `[1,2,3,...]`. Since there are no duplicates, any missing bucket or out-of-order bucket would cause a value greater than `k` in the `k`'th place, making the resulting list be bigger..
[Answer]
# Pyth, 6 bytes
```
UItMsS
```
[Try it here.](http://pyth.herokuapp.com/?code=UItMsS&input=%5B%5B6%2C+7%2C+8%2C+9%2C+10%5D%2C+%5B1%5D%2C+%5B2%5D%2C+%5B3%2C+4%2C+5%5D%2C+%5B11%2C+12%2C+13%5D%5D&debug=0)
Explanation:
```
UItMsSQ
UI      Invariant from U (range(len(A)) for our purpose)
  tM     Map t (A - 1 for our purpose)
    s     s (flatten 1-deep for our purpose)
     S     S (sort for our purpose)
      Q     Q (autoinitialized to input) (implicit)
```
[Answer]
# PROLOG (SWI), 54 bytes
```
s(L):-sort(L,M),flatten(M,N),last(N,O),numlist(1,O,N).
```
Now *that's* better. Still quite verbose, alas.
[Try it online!](https://tio.run/##pZHLDoIwEEX3foVh1SYXYnmIjxh/gMcHEBYswJBUMG0Jn48DiHvrYjqZae6ZO@1L9bJ/uHpsp0mzhF9c3SvDEqQcjayMqTuWIuOQlTYsQ87RDU/ZUiGQ04U33d3kVhQhohLFGeJAScBHQPmIGKeyxJ7NbIyqNbXsmGPUUDv8@q2bSmpqcG@3whYdNhiFTxFgnSEEhA8RWHDJFcIPMgJNsWDQbquazsXlHz7sPWz6eH4c8mLDCJc/2rb5gTC9AQ "Prolog (SWI) – Try It Online")
The `s/1` predicate takes a list as argument and is true if the list is a list of easily stackable buckets.
Improvement in algorithm: if I sort the list *before* I flatten it, this forces all the sublists to be sorted for the predicate to be true. Slightly "borrowed" from [Pietu1998's Jelly answer](https://codegolf.stackexchange.com/a/137508/71426). Thanks to that I can dump the `forall` which is more than half of the program (see below for the original answer).
## How does it work?
The predicate is true if all of its clauses are true:
```
s(L) :-
    sort(L,M),                % M is L sorted in ascending order
    flatten(M,N),             % N is the 1-dimention version of M
    last(N,O),                % O is the last elemnt of N
    numlist(1,O,N).           % N is the list of all integers from 1 to O
```
## Previous answer, PROLOG (SWI), 109 bytes
```
s(L):-flatten(L,M),sort(M,N),last(N,O),numlist(1,O,N),forall(member(A,L),(A=[B|_],last(A,C),numlist(B,C,A))).
```
[Try it online!](https://tio.run/##nZDLasNADEX3@YqSlQTXoeNH@iIUJ1sn@QBjigvjYhjbZWZCNvl3R/E07bpeaIRG3KMrfdvBDF@RO7fj6Kjg16gxtfe6pwJ7hhuspz0ODFM7TwccGf2pM60UCsdboxlsbQx1uvvUlnIUDMo35fbyUQVRjt2faIsdcmZeje9RsSnLFFmF8gXqUZJCjETyGk94rio80M0Szrb12vS09Pakl/z2Wze1cfLBq0WATTrcYRKxRIIwQymoGCqZwRVXSH@QGWTKDIbsFtTyTi5nMYKPTBzIcsKaw0inG9/d/IMwXgE "Prolog (SWI) – Try It Online")
[Answer]
# [Pyth](http://pyth.readthedocs.io), ~~9 16~~ 11 bytes (Fixed)
Uses a completely different method from the other answer. A shorter, 7-byte approach can be found below.
```
!.EtM.++0sS
```
**[Test Suite.](http://pyth.herokuapp.com/?code=%21.EtM.%2B%2B0sS&input=%5B%5B4%2C5%5D%2C%5B9%2C10%5D%2C%5B1%2C2%2C3%5D%2C%5B6%2C7%2C8%5D%5D&test_suite=1&test_suite_input=%5B%5B4%2C5%5D%2C%5B9%2C10%5D%2C%5B1%2C2%2C3%5D%2C%5B6%2C7%2C8%5D%5D%0A%5B%5B6%2C7%2C8%2C9%2C10%5D%2C%5B1%5D%2C%5B2%5D%2C%5B3%2C4%2C5%5D%2C%5B11%2C12%2C13%5D%5D%0A%5B%5B2%2C3%2C4%5D%2C%5B1%5D%2C%5B5%2C6%2C7%5D%5D%0A%5B%5B1%2C2%5D%2C%5B5%2C6%5D%2C%5B7%2C8%2C9%5D%5D%0A%5B%5B1%2C3%2C4%5D%2C%5B5%2C7%5D%2C%5B2%2C6%5D%5D%0A%5B%5B1%2C4%2C3%5D%2C%5B2%5D%2C%5B5%2C6%5D%5D%0A%5B%5B2%2C3%2C4%5D%2C%5B5%2C6%2C7%5D%5D&debug=0)**
---
# Explanation
```
!.EtM.++0sSQ  -> Full program, with implicit input at the end.
          SQ  -> Sort the input by the highest element in each sublist.
         s    -> Flatten.
       +0     -> Prepend a 0.
     .+       -> Get the deltas of the list (i.e. differences between consecutive elements)
   tM         -> Decrement each element.
 .E           -> Any truthy element (1s are truthy, 0s are falsy)
!             -> Negate (to have coherent truthy / falsy values)
```
# How does this work?
Let's take a couple of examples, which make it easier to understand. Let's assume the input is `[[1,3,4],[5,7],[2,6]]`. The core of this algorithm is that each delta in the unflattened list must be *1* in order for the buckets to be stackable.
* First off, `S` turns it into `[[1, 3, 4], [2, 6], [5, 7]]`.
* Then, `s` flattens it: `[1, 3, 4, 2, 6, 5, 7]`.
* Prepend a `0` in front: `[0, 1, 3, 4, 2, 6, 5, 7]`
* `.+` gets the deltas of the list, `[1, 2, 1, -2, 4, -1, 2]`.
* `tM` decrements each element, `[0, 1, 0, -3, 3, -2, 1]`.
* Any non-`0` integer is truthy in Pyth, so we check if there is any truthy element with `.E` (which means the stack cannot be formed correctly). We get `True`.
* `!` negates the result, which turns `True` into `False`.
If the input was, for example, `[[6,7,8,9,10],[1],[2],[3,4,5],[11,12,13]]`, the algorithm would work this way:
* Sorted by the highest element: `[[1], [2], [3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13]]` and flattened, with a `0` prepended: `[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]`.
* Deltas: `[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]`. All get decremented: `[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]`.
* There is no truthy element, so we get `False`. By logical negation, the result is `True`.
---
# [Pyth](http://pyth.readthedocs.io), 7 bytes
```
qSlsQsS
```
**[Test Suite.](http://pyth.herokuapp.com/?code=qSlsQsS&input=%5B%5B4%2C5%5D%2C%5B9%2C10%5D%2C%5B1%2C2%2C3%5D%2C%5B6%2C7%2C8%5D%5D&test_suite=1&test_suite_input=%5B%5B4%2C5%5D%2C%5B9%2C10%5D%2C%5B1%2C2%2C3%5D%2C%5B6%2C7%2C8%5D%5D%0A%5B%5B6%2C7%2C8%2C9%2C10%5D%2C%5B1%5D%2C%5B2%5D%2C%5B3%2C4%2C5%5D%2C%5B11%2C12%2C13%5D%5D%0A%5B%5B2%2C3%2C4%5D%2C%5B1%5D%2C%5B5%2C6%2C7%5D%5D%0A%5B%5B1%2C2%5D%2C%5B5%2C6%5D%2C%5B7%2C8%2C9%5D%5D%0A%5B%5B1%2C3%2C4%5D%2C%5B5%2C7%5D%2C%5B2%2C6%5D%5D%0A%5B%5B1%2C4%2C3%5D%2C%5B2%5D%2C%5B5%2C6%5D%5D%0A%5B%5B2%2C3%2C4%5D%2C%5B5%2C6%2C7%5D%5D&debug=0)**
Port of the Python answer and a variation of [@Erik's solution](https://codegolf.stackexchange.com/a/137520/59487).
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 5 bytes
```
oc~⟦₁
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r/Pz@57tH8ZY@aGv//j4420zHXsdCx1DE0iNWJNgRiIyA21jHRMQXxDXUMjXQMjWNjAQ "Brachylog – Try It Online")
Explained unifications:
```
?o₀c₀~⟦₁.
?         The input (implicit)
 o₀       Sorted (subscript default = 0 => ascending)
   c₀     Concatenated (subscript default = 0 => no length check)
     ~    Inverse (find the input)
      ⟦₁   Range (subscript = 1 => [1..input])
        . The output (implicit)
```
Analytical explanation:
First of all we sort the list of lists, and then we concatenate (i.e. flatten 1-deep) (`oc`) so that the buckets get stacked right-to-left if possible. Then, to check if the buckets have been stacked correctly (i.e. no missing buckets or towers), we check that the resulting list is an inclusive range from 1 to its length. Now, instead of equal-checking the list with the [1..n] range of its length (`{l⟦₁?}`), we try to find an input to a function that generates such a range (`~⟦₁`), if there is one. If an input is found, then the program ends with no issues, so it triggers a `true.` status. If no input is found, the program fails, triggering a `false.` status.
[Answer]
# [Python 2](https://docs.python.org/2/), 43 bytes
```
lambda l:sum(sorted(l),[0])<range(len(`l`))
```
[Try it online!](https://tio.run/##XU5LCoMwEN33FC4TeAsTtT/ak6QBLca2EKNouujp0yGpFF28GZj3m/Hjn4OTobvegm36e9tk9jy/ezYPkzctsxwq1/wyNe5hmDWO1bbmPIzTy/msY0qVqDTUCSKnJSBR0N7jgKPWfPfXxRMWHUESCiS7EBASolhbKAvlT12BAtY0lSWCZsze0sldkY/aSLahy/jqkqF5@AI "Python 2 – Try It Online")
Checks whether the concatenated sorted list is lexicographically smaller than `[1,2,3,...N]` for large `N`. Since there are no duplicates, any missing bucket or out-of-order bucket would cause a value greater than `k` in the `k`'th place, making the resulting list be bigger. The string-length of the input suffices as an upper bound since each numbers takes more than 1 character.
[Answer]
# [MATL](https://github.com/lmendo/MATL), 5 bytes
```
Sgtf=
```
[Try it online!](https://tio.run/##y00syfmf8D84vSTN9r@9gnpJUWlJRqU6V616WmJOcWqleiyXS8j/6mgTHdNYnWhLHUMDIGWoY6RjDKTNdMx1LGJruapBIkC@qY4ZkASK6ViCRYGqdExA6iFyOuZQtRBRUyBfB6jGLLZWAQA "MATL – Try It Online")
(Implicit input, say `{[4,5],[9,10],[1,2,3],[6,7,8]}`)
`S` - sort input arrays in lexicographic order (`{[1,2,3],[4,5],[6,7,8],[9,10]}`)
`g` - convert into a single array (`cell2mat`)
`t` - duplicate that
`f` - find indices of non-zero values. Since input here is all non-zeros, returns the list of indices from 1 to length(array) (`[1,2,3,4,5,6,7,8,9,10],[1,2,3,4,5,6,7,8,9,10]`)
`=` - check that the array is equal to the range 1 to length(array)
[Answer]
# [Japt](https://github.com/ETHproductions/japt/), ~~13~~ ~~12~~ 11 bytes
This could probably be shorter.
```
ñÎc äaT e¥1
```
* 1 byte saved thanks to [ETH](https://codegolf.stackexchange.com/users/42545/ethproductions)
[Try it](https://ethproductions.github.io/japt/?v=1.4.6&code=8c5jIORhVCBlpTE=&input=W1s2LDcsOCw5LDEwXSxbMV0sWzJdLFszLDQsNV0sWzExLDEyLDEzXV0=) or [run all test cases](https://ethproductions.github.io/japt/?v=1.4.6&code=8c5jIORhVCBlpTE=&input=WwpbWzQsNV0sWzksMTBdLFsxLDIsM10sWzYsNyw4XV0KW1s2LDcsOCw5LDEwXSxbMV0sWzJdLFszLDQsNV0sWzExLDEyLDEzXV0KW1syLDMsNF0sWzFdLFs1LDYsN11dCltbMSwyXSxbNSw2XSxbNyw4LDldXQpbWzIsMyw0XSxbNSw2LDddXQpbWzEsMyw0XSxbNSw3XSxbMiw2XV0KW1sxLDQsM10sWzJdLFs1LDZdXQpdLW1S)
---
## Explanation
```
                :Implicit input of 2D array `U`
ñÎ              :Sort sub-arrays by their first element
  c             :Flatten
      T         :Prepend 0
    äa          :Consecutive absolute differences
        e¥1     :Does every element equal 1?
```
[Answer]
## Scala, 49 Bytes
```
p=>{val s=p.sortBy(_(0)).flatten
s==(1 to s.max)}
```
Ungolfed:
```
piles: List[List[Int]] =>
{
  val sorted = piles.sortBy(pile=>pile(0)).flatten //Since piles are sequential, we can sort them by their first element
  sorted == (1 to sorted.max) //If all the buckets are present and in order, after sorting them it should be equivalent to counting up from 1 to the max bucket
}
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 9 bytes
```
ñg c
eUÌõ
```
[Try it online!](https://tio.run/##y0osKPn///DGdIVkrtTQwz2Ht/7/Hx1tqGOsYxKrE22qYw4kjXTMYmMB "Japt – Try It Online")
[Answer]
# [R](https://www.r-project.org/), 58 bytes
```
function(v,a=unlist(v[order(sapply(v,min))]))any(a-seq(a))
```
[Try it online!](https://tio.run/##lZBLi8IwFIX3/RUBN7lwRyatHR/gYgZ0JS58rMRFJqZQpk1rU0V/fU2q1uJrNIt7Q27ynZOTFUG/CDZK5GGi6BZ5f6OiUOd0u0iylcyo5mka7c0kDhXAEoCrPeUfWq4pBygaZNz8aZIeGX6PpgMSS640yaTOufjjv5FEMpvMz@cqUfWZ4zgBLcUEbaEPKGgX2aftDF307OYL29gBAFJfDSJ3qRS5XB1lL5jyOlYUW1xbPDwJMIbMReZZ5GOMEcdWRfDRYK89vOLG/OL03rbS2UsYG9kdM//4eE5hF0q7jMWYet8LMzl6Var@M8YtxSkO "R – Try It Online")
N.B. : FALSE is the truthy outcome, TRUE is the falsy one
* -3 bytes thanks to @JayCe
Explanation : 
```
a=unlist(v[order(sapply(v,min))])  # order the list of vector by the min value and flatten
all(a==seq(a=a))                   # if the flattened list is equal to 1:length then it's ok
```
[Answer]
# [C# (.NET Core)](https://www.microsoft.com/net/core/platform), ~~157~~ ~~145~~ 132 bytes
*-13 bytes thanks to [TheLethalCoder](https://codegolf.stackexchange.com/users/38550/thelethalcoder)*
```
l=>{var k=l.OrderBy(x=>x[0]).SelectMany(x=>x);return!Enumerable.Range(1,k.Count()).Zip(k,(x,y)=>x==y).Any(x=>!x);}
```
Byte count also includes
```
using System.Linq;
```
[Try it online!](https://tio.run/##bVLfT9swEH5e/grDS53JWE2BMdSlGkPAC2gToCEt5MFNj9bCdTrbgVaof3t3tsm2UE7yr/N33919dmX3qtrAprFST8nNyjqY89NaKaicrLXlF6DByGqYdBCXUv9@47qFpePXMG2UMGfLhQFrPcEw0WIOdiEqeEUmLwlBq5SwlpyEffR4s044WZGnWk7IlZCapn@v/oG8dQ7nja6@XErr4iS1G40YGde1GpEHkm9UPnp5EoY85op/NxMw31Z0mY@WRb9M@Q34Zq@Ejr50aMA1Ru@c6WYORowV8Guhp0Az9ojSNNrRNOW/5II@MrpkqxSD8nyV8pPIsIMU680w@RD7MV4jqReNG3Zqfp5JBYTScEVycopi1T4XiAnKC5iE7OREN0qlncCuDt58awobRxYNz@SNEDQdbkW0ScPKb42cUxSiGcdysdPXm0vQUzcje2SAJFss@NqwJCbMMXXw0K@79wUt@nvHjJQf0/ty950KfM1z4aoZWIwNHPwqnqMk78Q84E8V1YzQAIzhWGjLk24FePPC8JPJhAYUvzB1s7BFVvKfQjXAbxZKOtpjPUZ6pJfyuxkYoGJckXxEcGklGJF@@1XaW1SX/xDGBjh@idvai47vhlJtldI@752RDsL7PlBfWvqmz3XS3a2T9aYoDthhyYpjlvVxydiA7eP6iR2xz2WZFHHH2mscAxz7LEZlGcsGLNsPSIxkB6@gQ4ZxwYuM8YxzYOpg/8e1niOfBPHRexDqaTnKPw "C# (.NET Core) – Try It Online")
Ungolfed:
```
l => {
        var k = l.OrderBy(x=>x[0])              // First, sort stacks by first bucket
                 .SelectMany(x => x);           // Concatenate stacks into one
        return !Enumerable.Range(1, k.Count())  // Create a sequence [1...n]
               .Zip(k, (x, y) => x == y)        // Check if our big stack corresponds the sequence
               .Any(x => !x);                   // Return if there were any differences
     };
```
[Answer]
# [CJam](https://sourceforge.net/p/cjam), 11 bytes
```
{$:+:(_,,=}
```
[Try it online!](https://tio.run/##S85KzP1fWPe/WsVK20ojXkfHtvZ/3f/oaDMFcwULBUsFQ4NYhWhDIDYCYmMFEwVTEN9QwdBIwdA4NhYA "CJam – Try It Online")
Oww `:(`...yeah! `{$:+_,,:)=}`
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 19 bytes (non-competing?)
```
Ａ▷m⟦▷s▷vθυ⟧θ⁼θ…·¹Ｌθ
```
[Try it online!](https://tio.run/##S85ILErOT8z5///9noWPpm3PfTR/GZAqBuKyczvOtz6av/zcjkeNe4BEw7JD2w/tfL9nzbkd//9HR0eb6SiY6yhY6ChY6igYGsTqKEQbgggjEGGso2Cio2AKFjQEShsBsXFsbCwA "Charcoal – Try It Online")
-10 bytes thanks to [ASCII-only](https://codegolf.stackexchange.com/users/39244/ascii-only).
-3 bytes thanks to [ASCII-only](https://codegolf.stackexchange.com/users/39244/ascii-only) for a subsequent implementation (see revision history for possibly competing version).
`-` for truthy,  for falsy.
Input is a singleton list of a list of lists, because of how Charcoal takes input.
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 5 bytes
```
sf₅ɾ⁼
```
[Try it Online!](https://lyxal.pythonanywhere.com?flags=&code=sf%E2%82%85%C9%BE%E2%81%BC&inputs=%5B%5B3%2C4%5D%2C%5B1%2C2%5D%2C%5B5%2C6%5D%5D&header=&footer=)
```
s     # Sort
 f    # Flatten
  ₅ɾ  # 1...a.length
    ⁼ # Is equal?
```
[Answer]
# Java 10, 213 bytes
```
import java.util.*;m->{Arrays.sort(m,(a,b)->Long.compare(a[0],b[0]));var r=Arrays.stream(m).flatMapToInt(Arrays::stream).toArray();return Arrays.equals(r,java.util.stream.IntStream.range(1,r.length+1).toArray());}
```
[Try it online.](https://tio.run/##rVLBTuMwEL33K@Zos1ND2kLZRiDtZaWVgAvcqh6mwZSU2M46DquqyreXIQkQWgGiWimy/DyZ9@Y9e0mP1F/ePmxSkzsfYMlYlSHN1EHcSzIqCrik1K57AKkN2t9RouHqGQLMncs0WUgEl6az6QyMjLlS9XgpAoU0gSuwcAYb0z9f//KeVoUqWEYYFIRz2T@/cHahEmdy8lrQ9GiGc16kjGtKf/bSFLwmI4xUdxmFS8pv3B8bRFOdTJqyVMHVJ0LGXofSW2jb9d@SskJ4fLPXtChmuW52nuxCiwi9yrRdhPsfUYdPxtXm2Rp/eTnP2Fjr79Glt2A4IcE0qV1wCCSbeA4P4caX4X41qeH1qgjaKFcGlfOfIbPCqkRY/Q/a@Nav@/UIjyt8gz8xOuriCAc47B6c4BhPq0rW@X9Tq@7FHYkuGHTBELemiyKMBhgN99RnKzj6UPoYeb5PmdvKS@a/@ab1PplzqFvCXVhn9L8cfm3qszF3yMbv7orn3pd59P5V7eTR8la9avME)
It seemed like a good idea when I started, but these builtins only make it longer.. Can definitely be golfed by using a more manual approach..
Inspired by [*@EriktheOutgolfer*'s 4-byte 05AB1E answer](https://codegolf.stackexchange.com/a/137518/52210). 4 vs 213 bytes, rofl.. >.>
**Explanation:**
```
import java.util.*;      // Required import for Arrays
m->{                     // Method with 2D integer-array parameter and boolean return-type
  Arrays.sort(m,         //  Sort the 2D input-array on:
    (a,b)->Long.compare(a[0],b[0])); 
                         //  The first values of the inner arrays
var r=Arrays.stream(m).flatMapToInt(Arrays::stream).toArray();
                         //  Flatten the 2D array to a single integer-array
return Arrays.equals(r,  //  Check if this integer-array is equal to:
  java.util.stream.IntStream.range(1,r.length+1).toArray());} 
                         //  An integer-array of the range [1, length+1]
  
```
]