#include using namespace std; #define REP(i, n) for(int (i) = 0; (i) < (n); (i)++) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) typedef long long ll; int main(void){ int n; cin >> n; vector< vector > v(n, vector(100)); vector p(n); REP(i, n){ cin >> p[i]; REP(j, p[i]){ cin >> v[i][j]; } } vector line; int flg = 1, cnt = 0; while(flg){ flg = 0; REP(i, n){ if(p[i] > cnt){ line.push_back(v[i][cnt]); flg = 1; } } cnt++; } REP(i, line.size()){ cout << line[i] << ' '; } cout << endl; return 0; }