Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. first = input().split()
  2. second = input().split()
  3. n = 0
  4.  
  5. while first and second:
  6. n += 1
  7. a, b = first.pop(0), second.pop(0)
  8. if a > b and (b, a) != ('0', '9') or (a, b) == ('0', '9'):
  9. first += [a, b]
  10. else:
  11. second += [a, b]
  12. if n == 1000000:
  13. print('botva')
  14. break
  15. else:
  16. print('first' if first else 'second', n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement