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 C# (Mono 4.6.2.0) (judge verdict: Wrong Answer)

using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{
    public static void Main()
    {
        long N = long.Parse(Console.ReadLine());
        if (N == 1) { Console.WriteLine(long.Parse(Console.ReadLine()) % 2 == 0 ? "second" : "first"); return; }
        long box;
        long max0 = 0, max1 = 0;
        for (int i = 0; i < N; i++)
        {
            box = long.Parse(Console.ReadLine());
            if (box > max0)
            {
                max1 = max0;
                max0 = box;
            }
            else if (max0 > box && box > max1)
            {
                max1 = box;
            }
        }
        if (max1 == 1) { Console.WriteLine("first"); }
        else Console.WriteLine((max0 - max1) % 2 == 0 ? "second" : "first");
    }
}

public class PrimeFactor
{

    public IEnumerable<long> Enumerate(long n)
    {
        while (n > 1)
        {
            long factor = GetFactor(n);
            yield return factor;
            n = n / factor;
        }
    }

    private long GetFactor(long n, int seed = 1)
    {
        if (n % 2 == 0)
            return 2;
        if (IsPrime(n))
            return n;
        long x = 2;
        long y = 2;
        long d = 1;
        long count = 0;
        while (d == 1)
        {
            count++;
            x = f(x, n, seed);
            y = f(f(y, n, seed), n, seed);
            d = Gcd(Math.Abs(x - y), n);
        }
        if (d == n)
            // 見つからなかった、乱数発生のシードを変えて再挑戦。
            return GetFactor(n, seed + 1);
        // 素数でない可能性もあるので、再度呼び出す
        return GetFactor(d);
    }

    private int[] seeds = new int[] { 3, 5, 7, 11, 13, 17 };
    private long f(long x, long n, int seed)
    {
        return (seeds[seed % 6] * x + seed) % n;
    }

    private static long Gcd(long a, long b)
    {
        if (a < b)
            return Gcd(b, a);  // 引数を入替えて自分を呼び出す
        if (b == 0)
            return a;
        long d = 0;
        do
        {
            d = a % b;
            a = b;
            b = d;
        } while (d != 0);
        return a;
    }

    // 効率は良くないが、これでも十分な速度がでたので、良しとする。
    private static bool IsPrime(long number)
    {
        long boundary = (long)Math.Floor(Math.Sqrt(number));

        if (number == 1)
            return false;
        if (number == 2)
            return true;

        for (long i = 2; i <= boundary; ++i)
        {
            if (number % i == 0)
                return false;
        }

        return true;
    }
}


public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static int LCM(int a, int b)
    {
        int c = a * b;
        if (a < b) Swap(ref a, ref b);
        int d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string StrReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int intRead()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
    public static long[] LSRead()
    {
        return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
    }
}