#include using namespace std; using ll = long long; #define rep(i,n) for(ll i=0;i<(n);++i) main(){ ll n; cin>>n; vector p(n); vector> a(n); rep(i,n){ cin>>p[i]; a[i].resize(p[i]); rep(j,p[i])cin>>a[i][j]; } vector> x(*max_element(p.begin(),p.end())); rep(i,n){ rep(j,p[i])x[j].emplace_back(a[i][j]); } for(auto& v:x)sort(v.begin(),v.end()); for(auto y:x){ for(auto x:y){ cout<