import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Deck p1 = new Deck(br.readLine().split(" "));
		Deck p2 = new Deck(br.readLine().split(" "));
		ArrayList<Card> pool = new ArrayList<>();

		while (!p1.isEmpty() && !p2.isEmpty()) {
			if (p1.get(0).getValue() > p2.get(0).getValue()) {
				p1.won(p2, pool);
				System.out.println("p1 won size: " + p1.size());
			} else if (p1.get(0).getValue() < p2.get(0).getValue()) {
				p2.won(p1, pool);
				System.out.println("p2 won size: " + p2.size());
			} else {
				if (p1.size() < 4 || p2.size() < 4) {
					System.out.println("Tie ");
					break;
				} else {
					System.out.println("War started");
					for (int i = 3; i >= 0; i--) {
						pool.add(p2.get(i));
						p2.remove(i);
						pool.add(p1.get(i));
						p1.remove(i);
					}
				}
			}
		}
	}

	private static class Deck extends ArrayList<Card> {

		public Deck(String[] cardValues) {
			for (String i : cardValues) {
				this.add(new Card(Integer.parseInt(i)));
			}
		}

		public void won(Deck d, ArrayList<Card> pool) {
			this.addAll(pool);
			pool.clear();
			this.add(d.get(0));
			d.remove(0);
			Card c = this.get(0);
			this.remove(c);
			this.add(c);
		}
	}

	public static class Card {

		private int value;

		public Card(int value) {
			this.value = value;
		}

		public int getValue() {
			return this.value;
		}
	}
}