#include using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; vector> As(N, vector(100, 0)); for (auto & Ai : As){ int p; cin >> p; for (int j = 0; j < p ; ++j) cin >> Ai[j]; } vector ans; for (int j = 0; j < 100; ++j){ for (int i = 0; i < N; ++i){ if (As[i][j] != 0) ans.push_back(As[i][j]); } } cout << ans[0]; for (int k = 1; k < ans.size(); ++k) cout << " " << ans[k]; return 0; }