#include using namespace std; using ll = long long; int main() { ll a, b, c; cin >> a; cin >> b >> c; vector> v(a); vector bought(b, 0ll); while (c--) { int x; ll y, z; cin >> x >> y >> z; if (x==1) { v[z-1].push(y); } else { ll w; w = v[y-1].front(); v[y-1].pop(); v[z-1].push(w); bought[w-1]++; } } for (int i = 0; i < b; i++) cout << bought[i] << endl; }