# discrepancy, balanced 2-coloring, IMO6 1986
from sys import stdin, stdout
input=stdin.readline
def f(x,y):
return 10**9*x+y
#def g(c):
# return c//10**9,c%10**9
def main():
N = int(input())
d={}
hor={}
ver={}
for i in range(N):
x,y = list(map(int, input().split()))
d[f(x,y)] = i
try: hor[y].append(x)
except: hor[y]=[x]
try: ver[x].append(y)
except: ver[x]=[y]
res=[0]*N
graph={}
for y in hor:
for i in range(len(hor[y])//2):
try: graph[f(hor[y][2*i],y)].append(f(hor[y][2*i+1],y))
except: graph[f(hor[y][2*i],y)] = [f(hor[y][2*i+1],y)]
try: graph[f(hor[y][2*i+1],y)].append(f(hor[y][2*i],y))
except: graph[f(hor[y][2*i+1],y)] = [f(hor[y][2*i],y)]
for x in ver:
for i in range(len(ver[x])//2):
try: graph[f(x,ver[x][2*i])].append(f(x,ver[x][2*i+1]))
except: graph[f(x,ver[x][2*i])] = [f(x,ver[x][2*i+1])]
try: graph[f(x,ver[x][2*i+1])].append(f(x,ver[x][2*i]))
except: graph[f(x,ver[x][2*i+1])] = [f(x,ver[x][2*i])]
while graph:
v,cur=graph.popitem()
l=1
res[d[v]]=1
while cur:
if l%2==0:
for v in cur:
res[d[v]]=1
tmp=[]
for v in cur:
if v in graph:
sz=graph.pop(v)
for w in sz:
if w in graph:
tmp.append(w)
cur=tmp
l+=1
#print(''.join(res))
for x in res:
if x==0:
stdout.write('L')
else:
stdout.write('F')
stdout.write('\n')
main()
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 18ms | 11836 KiB | ||||
2 | Accepted | 742ms | 134184 KiB | ||||
subtask2 | 5/5 | ||||||
3 | Accepted | 597ms | 134520 KiB | ||||
4 | Accepted | 603ms | 134772 KiB | ||||
subtask3 | 0/7 | ||||||
5 | Accepted | 597ms | 134520 KiB | ||||
6 | Accepted | 603ms | 134772 KiB | ||||
7 | Accepted | 615ms | 135244 KiB | ||||
8 | Runtime error | 477ms | 135148 KiB | ||||
9 | Runtime error | 490ms | 135036 KiB | ||||
10 | Accepted | 439ms | 105384 KiB | ||||
subtask4 | 0/20 | ||||||
11 | Runtime error | 523ms | 134960 KiB | ||||
12 | Runtime error | 524ms | 135048 KiB | ||||
13 | Runtime error | 524ms | 134976 KiB | ||||
14 | Runtime error | 529ms | 134892 KiB | ||||
15 | Runtime error | 529ms | 134864 KiB | ||||
16 | Accepted | 421ms | 105512 KiB | ||||
subtask5 | 13/13 | ||||||
17 | Accepted | 17ms | 13148 KiB | ||||
18 | Accepted | 17ms | 13500 KiB | ||||
19 | Accepted | 17ms | 13452 KiB | ||||
20 | Accepted | 17ms | 13688 KiB | ||||
21 | Accepted | 17ms | 13868 KiB | ||||
22 | Accepted | 17ms | 13532 KiB | ||||
23 | Accepted | 17ms | 13612 KiB | ||||
24 | Accepted | 17ms | 13536 KiB | ||||
25 | Accepted | 17ms | 13460 KiB | ||||
26 | Accepted | 17ms | 13532 KiB | ||||
27 | Accepted | 17ms | 13680 KiB | ||||
28 | Accepted | 17ms | 13796 KiB | ||||
29 | Accepted | 17ms | 13708 KiB | ||||
30 | Accepted | 17ms | 13576 KiB | ||||
31 | Accepted | 17ms | 13756 KiB | ||||
32 | Accepted | 17ms | 13752 KiB | ||||
33 | Accepted | 17ms | 13520 KiB | ||||
subtask6 | 20/20 | ||||||
34 | Accepted | 17ms | 13148 KiB | ||||
35 | Accepted | 17ms | 13500 KiB | ||||
36 | Accepted | 17ms | 13452 KiB | ||||
37 | Accepted | 17ms | 13688 KiB | ||||
38 | Accepted | 17ms | 13868 KiB | ||||
39 | Accepted | 17ms | 13532 KiB | ||||
40 | Accepted | 17ms | 13612 KiB | ||||
41 | Accepted | 17ms | 13536 KiB | ||||
42 | Accepted | 17ms | 13460 KiB | ||||
43 | Accepted | 17ms | 13532 KiB | ||||
44 | Accepted | 17ms | 13680 KiB | ||||
45 | Accepted | 17ms | 13796 KiB | ||||
46 | Accepted | 17ms | 13708 KiB | ||||
47 | Accepted | 17ms | 13576 KiB | ||||
48 | Accepted | 17ms | 13756 KiB | ||||
49 | Accepted | 17ms | 13752 KiB | ||||
50 | Accepted | 17ms | 13520 KiB | ||||
51 | Accepted | 25ms | 14980 KiB | ||||
52 | Accepted | 25ms | 14912 KiB | ||||
53 | Accepted | 25ms | 14964 KiB | ||||
54 | Accepted | 24ms | 14916 KiB | ||||
55 | Accepted | 23ms | 14504 KiB | ||||
56 | Accepted | 23ms | 14716 KiB | ||||
57 | Accepted | 23ms | 14656 KiB | ||||
58 | Accepted | 25ms | 14888 KiB | ||||
59 | Accepted | 24ms | 15232 KiB | ||||
60 | Accepted | 23ms | 14984 KiB | ||||
61 | Accepted | 23ms | 14900 KiB | ||||
62 | Accepted | 23ms | 15096 KiB | ||||
63 | Accepted | 23ms | 15100 KiB | ||||
64 | Accepted | 24ms | 15108 KiB | ||||
65 | Accepted | 23ms | 14912 KiB | ||||
subtask7 | 0/35 | ||||||
66 | Accepted | 17ms | 13148 KiB | ||||
67 | Runtime error | 541ms | 134408 KiB | ||||
68 | Accepted | 597ms | 134520 KiB | ||||
69 | Accepted | 603ms | 134772 KiB | ||||
70 | Accepted | 615ms | 135244 KiB | ||||
71 | Runtime error | 477ms | 135148 KiB | ||||
72 | Runtime error | 490ms | 135036 KiB | ||||
73 | Accepted | 439ms | 105384 KiB | ||||
74 | Runtime error | 523ms | 134960 KiB | ||||
75 | Runtime error | 524ms | 135048 KiB | ||||
76 | Runtime error | 524ms | 134976 KiB | ||||
77 | Runtime error | 529ms | 134892 KiB | ||||
78 | Runtime error | 529ms | 134864 KiB | ||||
79 | Accepted | 421ms | 105512 KiB | ||||
80 | Accepted | 17ms | 13500 KiB | ||||
81 | Accepted | 17ms | 13452 KiB | ||||
82 | Accepted | 17ms | 13688 KiB | ||||
83 | Accepted | 17ms | 13868 KiB | ||||
84 | Accepted | 17ms | 13532 KiB | ||||
85 | Accepted | 17ms | 13612 KiB | ||||
86 | Accepted | 17ms | 13536 KiB | ||||
87 | Accepted | 17ms | 13460 KiB | ||||
88 | Accepted | 17ms | 13532 KiB | ||||
89 | Accepted | 17ms | 13680 KiB | ||||
90 | Accepted | 17ms | 13796 KiB | ||||
91 | Accepted | 17ms | 13708 KiB | ||||
92 | Accepted | 17ms | 13576 KiB | ||||
93 | Accepted | 17ms | 13756 KiB | ||||
94 | Accepted | 17ms | 13752 KiB | ||||
95 | Accepted | 17ms | 13520 KiB | ||||
96 | Accepted | 25ms | 14980 KiB | ||||
97 | Accepted | 25ms | 14912 KiB | ||||
98 | Accepted | 25ms | 14964 KiB | ||||
99 | Accepted | 24ms | 14916 KiB | ||||
100 | Accepted | 23ms | 14504 KiB | ||||
101 | Accepted | 23ms | 14716 KiB | ||||
102 | Accepted | 23ms | 14656 KiB | ||||
103 | Accepted | 25ms | 14888 KiB | ||||
104 | Accepted | 24ms | 15232 KiB | ||||
105 | Accepted | 23ms | 14984 KiB | ||||
106 | Accepted | 23ms | 14900 KiB | ||||
107 | Accepted | 23ms | 15096 KiB | ||||
108 | Accepted | 23ms | 15100 KiB | ||||
109 | Accepted | 24ms | 15108 KiB | ||||
110 | Accepted | 23ms | 14912 KiB | ||||
111 | Runtime error | 541ms | 134200 KiB | ||||
112 | Accepted | 684ms | 132476 KiB | ||||
113 | Accepted | 686ms | 132024 KiB | ||||
114 | Runtime error | 532ms | 134216 KiB | ||||
115 | Runtime error | 532ms | 134440 KiB | ||||
116 | Runtime error | 544ms | 134348 KiB | ||||
117 | Runtime error | 532ms | 134332 KiB | ||||
118 | Runtime error | 536ms | 134428 KiB | ||||
119 | Runtime error | 536ms | 134232 KiB | ||||
120 | Runtime error | 532ms | 134400 KiB | ||||
121 | Runtime error | 532ms | 134348 KiB |