summaryrefslogtreecommitdiffstats
path: root/Main/Python/2011/S3.py
blob: c52b27cf01d33391aece34e2cbea68d8d02bf4be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from math import floor

formation = ((1, 0), (2, 0), (3, 0), (2, 1))
next_formation = ((1, 1), (2, 2), (3, 1))

T = int(input())
for i in range(T):
    m, x, y = tuple(map(int, input().split()))
    close_x = [floor(x / (5 ** mx)) for mx in range(m)][::-1]
    close_y = [floor(y / (5 ** my)) for my in range(m)][::-1]
    for mag, mx, my in zip(range(m), close_x, close_y):
        offset = (mx % 5, my % 5)
        if offset in formation:
            print("crystal")
            break
        elif offset in next_formation and mag != m - 1:
            continue
        else:
            print("empty")
            break