import sys
import numpy as np
from collections import Counter

read = sys.stdin.read
readline = sys.stdin.readline

N, *AB = map(int, read().split())
A = np.array(AB[::2], np.int64)
B = np.array(AB[1::2], np.int64)
g = np.gcd(A, B)
A //= g
B //= g
a = Counter(A.tolist())
b = Counter(B.tolist())

