#include #define rep(i,n) for(int i=0;i ; const int INF = 1e9; const int MOD = 1000000007; int n = 1005; int p = 105; vector> people(n,vector(p,0)); int main(){ cin >> n; rep(i,n){ int p_; cin >> p_; rep(j,p_) cin >> people[i][j]; } vector ans; rep(j,p)rep(i,n){ if(people[i][j] == 0) continue; ans.push_back(people[i][j]); } for(int k:ans) cout << k << " "; cout << endl; return 0; }