ima=input()
N=int(input())
k=1
L=[ima]
for i in range (N):
Z1,Z2=map(str,input().split())
if Z2==ima:
ima=Z1
if bool(Z1 in L)==0:
k+=1
L+=[Z1]
print(ima)
print(k)
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
3300 KB |
Output is correct |
2 |
Correct |
26 ms |
3300 KB |
Output is correct |
3 |
Correct |
27 ms |
3328 KB |
Output is correct |
4 |
Correct |
26 ms |
3428 KB |
Output is correct |
5 |
Correct |
26 ms |
3300 KB |
Output is correct |
6 |
Correct |
27 ms |
3300 KB |
Output is correct |
7 |
Correct |
25 ms |
3300 KB |
Output is correct |
8 |
Correct |
27 ms |
3300 KB |
Output is correct |
9 |
Correct |
24 ms |
3300 KB |
Output is correct |
10 |
Correct |
25 ms |
3300 KB |
Output is correct |