fork(2) download
  1. from sys import stdin
  2. from collections import Counter
  3.  
  4. n = int(stdin.readline())
  5.  
  6. line = list(int(i) for i in stdin.readline().strip().split())
  7.  
  8. if len(line) != n:
  9. raise AssertionError()
  10.  
  11. counter = Counter(line)
  12.  
  13. n = int(stdin.readline())
  14.  
  15. line = stdin.readline().strip().split()
  16.  
  17. if len(line) < n:
  18. raise AssertionError()
  19.  
  20. for i,val in enumerate(line):
  21. if i == n:
  22. break
  23.  
  24. if int(val) not in counter:
  25. print("brak")
  26. continue
  27.  
  28. if counter.get(int(val)) >= 3:
  29. print("Tak")
  30. continue
  31.  
  32. print("Nie")
  33.  
Success #stdin #stdout 0.02s 9344KB
stdin
19
-10 -2 -2 0 2 3 3 4 4  4 4 4 4 4 4 4 4 4 5 
9
0       1 2 3 4 5 4 4 44
stdout
Nie
brak
Nie
Nie
Tak
Nie
Tak
Tak
brak