Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. import sys
  2.  
  3. cases = int(raw_input())
  4. for c in xrange(cases):
  5. # read in misc problem constants
  6. x, y, z = map(int, raw_input().split())
  7.  
  8. if x == 1:
  9. print "Case #%d: GABRIEL" % ((c+1))
  10. if x == 2:
  11. if ((y * z)% 2 == 0):
  12. print "Case #%d: GABRIEL" % ((c+1))
  13. else:
  14. print "Case #%d: RICHARD" % ((c+1))
  15.  
  16. if x == 3:
  17. if ((y * z) % 3 == 0):
  18. if (y == 1 or z == 1):
  19. print "Case #%d: RICHARD" % ((c+1))
  20. else:
  21. print "Case #%d: GABRIEL" % ((c+1))
  22. else:
  23. print "Case #%d: RICHARD" % ((c+1))
  24. if x == 4:
  25. if ((y * z) % 4 == 0):
  26. if (y == 1 or z == 1):
  27. print "Case #%d: RICHARD" % ((c+1))
  28. elif (y == 2 or z == 2):
  29. print "Case #%d: RICHARD" % ((c+1))
  30. elif (y == 3 or z == 3):
  31. print "Case #%d: GABRIEL" % ((c+1))
  32. else:
  33. print "Case #%d: GABRIEL" % ((c+1))
  34. else:
  35. print "Case #%d: RICHARD" % ((c+1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement