#include using namespace std; int main() { int n, q; cin >> n >> q; std::vector > v(n); while (q--) { int op; cin >> op; if (op == 0) { int t, x; cin >> t >> x; v[t].push_back(x); } else if (op == 1) { int t; cin >> t; if (v[t].size() > 0) { for (int i = 0; i < v[t].size() - 1; i++) { cout << v[t][i] << " "; } cout << *v[t].rbegin(); } cout << endl; } else { int t; cin >> t; v[t].clear(); } } }