import java.util.*;

public class SolutionIvan {
    public static void main(String[] args) throws Exception {
        new SolutionIvan().run();
    }

    void run() throws Exception {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i = 0; i < n; ++i) {
            a[i] = scanner.nextInt();
        }
        for (int i = 0; i < n; ++i) {
            b[i] = scanner.nextInt();
        }

        int ab = 0;
        int ba = 0;
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) {
                if (a[i] > b[j]) {
                    ab++;
                } else if (a[i] < b[j]) {
                    ba++;
                }
            }
        }

        if (ab > ba) {
            System.out.println("first");
        } else if (ab == ba) {
            System.out.println("tie");
        } else {
            System.out.println("second");
        }
    }
}

