#include <bits/stdc++.h>   using namespace std;   map<double, int> a;   double b[200007];   inline long long int read() {     long long int x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) x = x * 10 + ch -  0 , ch = getchar();     return x * f;   }   inline void writ(int x) {     if (x < 0) putchar( - ), x = -x;     if (x > 9) writ(x / 10);     putchar(x % 10 +  0 );   }   inline void write(int x) {     writ(x);     putchar(   );   }   int main() {     a.clear();     int n = read(), x, y, z;     for (int i = 1; i <= n; ++i)       x = read(), y = read(), z = read(), b[i] = (double)(x + y) / z, ++a[b[i]];     for (int i = 1; i <= n; ++i) write(a[b[i]]);     return 0;   }   