-
Notifications
You must be signed in to change notification settings - Fork 0
/
33271119.py
58 lines (53 loc) · 1.2 KB
/
33271119.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
for _ in range(int(input())):
s={}
s1={}
c=set({})
for i in range(12):
l=list(map(str,input().strip().split()))
d=int(l[1])-int(l[3])
b=-d
if l[0] in s:
s1[l[0]]+=d
if d>0:
s[l[0]]+=3
elif d==0:
s[l[0]]+=1
else:
s1[l[0]]=d
if d>0:
s[l[0]]=3
elif d==0:
s[l[0]]=1
else:
s[l[0]]=0
if l[4] in s:
s1[l[4]]+=b
if b>0:
s[l[4]]+=3
elif b==0:
s[l[4]]+=1
else:
s1[l[4]]=b
if b>0:
s[l[4]]=3
elif b==0:
s[l[4]]=1
else:
s[l[4]]=0
c.add(l[0])
c.add(l[4])
c=list(c)
d=max(s.values())
a=-10000000000
for i in c:
if s[i]==d and a<s1[i]:
f=i
a=s1[i]
s[f]=-10000000000
a=-10000000000
d=max(s.values())
for i in c:
if s[i]==d and a<s1[i]:
k=i
a=s1[i]
print(f,k,sep=' ')