Problem:
Score : 500 points

Problem Statement

There is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i.

You and Lunlun the dachshund alternately perform the following operation (starting from you):

Choose one or more apples from the tree and eat them. Here, the apples chosen at the same time must all have different colors.

The one who eats the last apple from the tree will be declared winner. If both you and Lunlun play optimally, which will win?

Constraints

1 \leq N \leq 10^5

1 \leq a_i \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
a_1
a_2
:
a_N

Output

If you will win, print first; if Lunlun will win, print second.

Sample Input 1

2
1
2

Sample Output 1

first

Let Color 1 be red, and Color 2 be blue. In this case, the tree bears one red apple and two blue apples.

You should eat the red apple in your first turn. Lunlun is then forced to eat one of the blue apples, and you can win by eating the other in your next turn.

Note that you are also allowed to eat two apples in your first turn, one red and one blue (not a winning move, though).

Sample Input 2

3
100000
30000
20000

Sample Output 2

second

Solution in Java8 (OpenJDK 1.8.0) (judge verdict: Runtime Error)

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long[] a = new long[N];
		for(int i = 0; i < N; i++) {
			a[i] = sc.nextLong();
		}
		sc.close();
		int cnt = 0;
		long sum = 0;
		long max = 0;
		Arrays.sort(a);
//		if(a[0] == a[N - 1]) {
//			String ans ="";
//			if(a[0] == 1) {
//				ans = "first";
//			}else {
//				if(a[0] % 2 == 0) {
//					ans = "first";
//				}else {
//					ans = "second";
//				}
//			}
//			System.out.println(ans);
//			System.exit(0);
//		}
		if(a[N - 2] == 0) {

		}
		if(a[0] == 1) {
			System.out.println("first");
			System.exit(0);
		}
		if(N == 1) {
			if(a[0] % 2 == 0) {
				System.out.println("second");
			}else {
				System.out.println("first");
			}
			System.exit(0);
		}
		if(a[N - 1] == 1) {
			System.out.println("first");
			System.exit(0);
		}
		if(a[N - 2] == 1) {
			if(a[N - 1] % 2 == 0) {
				System.out.println("first");
			}else {
				System.out.println("first");
			}
			System.exit(0);
		}
		if(a[N - 1] == a[0]) {
			if(a[0] == 1) {
				System.out.println("first");
			}else {
				if(a[0] % 2 == 0) {
					System.out.println("second");
				}else {
					System.out.println("first");
				}
			}
			System.exit(0);
		}

		for(int i = 0; i < N; i++) {
			sum += a[i];
			max = Math.max(max, a[i]);
		}

		if(sum % 2 == 1) {
			System.out.println("first");
		}else {
			System.out.println("second");
		}
	}
}