Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. from collections import defaultdict
  2.  
  3. G = defaultdict(set)
  4.  
  5. n, m = map(int, input().split())
  6.  
  7. for i in range(m):
  8. a, b = map(int, input().split())
  9. G[b].add(a)
  10.  
  11. def fun(b, ts):
  12.  
  13. ts = set(ts)
  14.  
  15. if len(G[b]) > len(ts):
  16. return False
  17.  
  18. if len(G[b].difference( ts ) ):
  19. return False
  20.  
  21. return True
  22.  
  23.  
  24.  
  25. for i in range(n):
  26. f1, f2, f3 = map(int, input().split())
  27.  
  28. if fun(f3, [f1, f2] ) and fun(f2, [f1]) and fun(f1, []):
  29. print("honest")
  30. else:
  31. print("liar")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement