Codeforces Round 281 (Div. 2)
B
Vasya and Wrestling
Codeforces
1400
原题
← AC →
翻译中…

Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.

翻译中…

When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.

翻译中…

If the sequences of the awarded points coincide, the wrestler who performed the last technique wins. Your task is to determine which wrestler won.

翻译中…

Input

翻译中…

The first line contains number $*n*$ — the number of techniques that the wrestlers have used ($1 ≤ *n* ≤ 2·10^{5}$).

翻译中…

The following $*n*$ lines contain integer numbers $*a*_{*i*}$ ($|*a*_{*i*}| ≤ 10^{9}$, $*a*_{*i*} ≠ 0$). If $*a*_{*i*}$ is positive, that means that the first wrestler performed the technique that was awarded with $*a*_{*i*}$ points. And if $*a*_{*i*}$ is negative, that means that the second wrestler performed the technique that was awarded with $( - *a*_{*i*})$ points.

翻译中…

The techniques are given in chronological order.

翻译中…

Output

翻译中…

If the first wrestler wins, print string "first", otherwise print "second"

翻译中…

Note

翻译中…

Sequence $*x*  =  *x*_{1}*x*_{2}... *x*_{|*x*|}$ is lexicographically larger than sequence $*y*  =  *y*_{1}*y*_{2}... *y*_{|*y*|}$, if either $|*x*|  >  |*y*|$ and $*x*_{1}  =  *y*_{1},  *x*_{2}  =  *y*_{2}, ... ,  *x*_{|*y*|}  =  *y*_{|*y*|}$, or there is such number $*r*$ ($*r*  <  |*x*|$, $*r*  <  |*y*|$), that $*x*_{1}  =  *y*_{1},  *x*_{2}  =  *y*_{2},  ... ,  *x*_{*r*}  =  *y*_{*r*}$ and $*x*_{*r*  +  1}  >  *y*_{*r*  +  1}$.

翻译中…

We use notation $|*a*|$ to denote length of sequence $*a*$.

翻译中…

样例

Input #1
5
1
2
-3
-4
3
Output #1
second
InputCopy OutputCopy
Input #2
3
-1
-2
3
Output #2
first
InputCopy OutputCopy
Input #3
2
4
-4
Output #3
second
InputCopy OutputCopy
题目信息
题号
493B
时间限制
2 s
内存限制
256 MB
标签
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。