Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n, m = map(int, input().split())
- pairs = []
- for i in range(m):
- a, b = input().split()
- pairs.append(a + b)
- triples = []
- ans = []
- for i in range(n):
- liar = False
- honest = False
- triple = list(input().split())
- for j in range(3):
- if liar is True:
- break
- a = triple[j]
- for pair in pairs:
- if liar is True:
- break
- if pair[1] == a:
- #print(a)
- first = pair[0]
- #print(first)
- if first in triple:
- if triple.index(first) > j:
- liar = True
- #print('l')
- else:
- honest = True
- #print('h')
- else:
- liar = True
- if honest is True and liar is False:
- for pair in pairs:
- if liar is True:
- break
- if pair[0] == a:
- second = pair[1]
- if second in triple:
- if triple.index(second) < j:
- liar = True
- else:
- honest = True
- else:
- continue
- #print(liar)
- #print(honest)
- if liar is True:
- ans.append('liar')
- elif honest is True:
- ans.append('honest')
- #print(pairs)
- for i in ans:
- print(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement