public static void main(String[] g) throws IOException {
		Scanner s = new Scanner(new File(g[0]));
		String l;
		while (s.hasNext()) {
			String[] L = new String[5];
			String[] R = new String[5];
			
			for (int i = 0; i < 5; i++) {
				L[i] = replace(s.next());
			}
			for (int i = 0; i < 5; i++) {
				R[i] = replace(s.next());
			}
			
			Arrays.sort(L);
			Arrays.sort(R);
			
			int[] r1 = rank(L);
			int[] r2 = rank(R);
			
			if (r1[0] > r2[0]) {
				System.out.println("left");
			} else if (r2[0] > r1[0]) {
				System.out.println("right");
			} else if (r1[0] == 1 && r2[0] == 1) {
				if (hi(L) > hi(R)) {
					System.out.println("left");
				} else if (hi(R) > hi(L)) {
					System.out.println("right");
				} else {
					System.out.println("none");
				}
			} else {
				System.out.println("none");
			}
		}
	}