# -*- coding: utf-8 -*-
# Правильная версия

import threading, time, sys

killed = False

lock1 = threading.Lock()
lock2 = threading.Lock()

def x(n, lock1, lock2):
  print(n, "started")
  while not killed:
    lock1.acquire()
    print(n)
    lock2.release()

lock1.acquire()
threading.Thread(target=x, args=[1, lock1, lock2]).start()
threading.Thread(target=x, args=[2, lock2, lock1]).start()

sys.stdin.readline()
killed = True