#!/usr/bin/env python3 n = int(input()) assert 0 <= n <= 4000 q = [] for _ in range(n): p, a, b = map(int, input().split()) assert 0 <= p <= 2 assert 1 <= a and 1 <= b assert a + b <= 4 * 10**5 q += [(p, a, b)] for i in range(n): for j in range(i): assert q[i][0] != q[j][0] or q[i][1]*q[j][2] != q[j][1]*q[i][2] print(0)