#include <cstdio> #include <cstring> #include <cstdlib> #include <iostream> #include <ctime> using namespace std; const int N = 1000; int n, t, x[N], y[N]; int gcd( int x, int y ) { if( x < 0 || y < 0 ) return gcd( abs(x), abs(y) ); return y == 0 ? x : gcd( y, x % y ); } int main() { freopen("sight.in", "r", stdin); freopen("sight.out", "w", stdout); for( scanf("%d", &t); t--; ) { scanf("%d", &n); for( int i = 0; i < n; i ++ ) { scanf("%d %d", &x[i], &y[i]); int g = gcd(x[i], y[i]); x[i] /= g; y[i] /= g; } int result = 0; for( int i = 0; i < n; i ++ ) { result ++; for( int j = i + 1; j < n; j ++ ) if( x[i] == x[j] && y[i] == y[j] ) { result --; break; } } cerr << n << " " << result << endl; printf("%d\n", result); } return 0; }