The first line contains the number of piles n (1≤n≤100).
Each of the next n lines contains si followed by si integers ci1,ci2,…,cisi (1≤si≤100, 1≤cij≤1000). Pile i holds si cards stacked from top to bottom in the order given, so ci1 is the top card and cisi is the bottom card.