Analyze overhanded shuffles Rod is moderating a card game between two players: George and Tim. Currently, Tim is shuffling the cards. Rod suspects that Tim is trying to cheat, so he needs your help to check that the shuffle is fair.

Tim is doing the overhanded shuffle: he cuts a pile of cards from the bottom of the deck, then cuts various parts from the top of the pile onto the top of the deck, and repeats the process a few times.

Rod is eagle-eyed and can see exactly how many cards Tim is cutting each time, however he can't calculate and keep track of the cards as fast as Tim is shuffling. This is where you come in: Rod would like you to write a program or function that gets the detailed shuffling information and determines whether the shuffle is fair, weak or a trick.


If after shuffling, less than 25 pairs of adjacent cards remain adjacent (in the same order), then the shuffle is fair and the game can go on.
If at least 25 (but not all) pairs of adjacent cards remain adjacent, then the shuffle is weak and Rod will bonk Tim over the head and ask him to shuffle some more.
If all the cards remain in the same position at the end, then Tim is obviously cheating and Rod will whack him with a large trout.


This is code golf, so the shortest code wins.

Input:

You will get a series of numbers between 0 and 52 (both exclusive) separated by space, on several lines, where each line represents a round of shuffling that begins and ends with all the cards piled together.

On each line, the first number is the number of cards Tim cuts from the bottom of the deck, and each subsequent number is a number of cards he drops from his hand onto the top of the deck. If any cards remain after the last number on a line, you should assume that Tim puts them on top of the deck.

The input is guaranteed to be valid. There is at least one line of numbers, and each line contains at least 2 numbers. The first number on each line is not smaller than the sum of all the other numbers on the same line. A trailing newline is optional, you may assume that the input has one or that it doesn't have one.

Output:

Your program should print/return "fair" if the shuffle is fair, "weak" if the shuffle is weak and "trick" if Tim is keeping all the cards in the same order. A trailing newline is optional.

Example:

The deck is assumed to have 52 cards, but for demonstration purposes, I'll use a smaller deck of 10 cards.

Input:

5 3 1
4 2 2


Initial deck, viewed from the top: 0 1 2 3 4 5 6 7 8 9
5 ➜ 0 1 2 3 4 (5 6 7 8 9 in hand)
3 ➜ 5 6 7 0 1 2 3 4 (8 9 in hand)
1 ➜ 8 5 6 7 0 1 2 3 4 (9 in hand)
end of line ➜ 9 8 5 6 7 0 1 2 3 4
4 ➜ 9 8 5 6 7 0 (1 2 3 4 in hand)
2 ➜ 1 2 9 8 5 6 7 0 (3 4 in hand)
2 ➜ 3 4 1 2 9 8 5 6 7 0
4 pairs remain adjacent: (3 4) (1 2) (5 6) (6 7)

Test cases:

43 5 5 5 5 5 5 5 5
43 5 5 5 5 5 5 5 5
43 5 5 5 5 5 5 5 5


Output: fair



43 5 5 5 5 5 5 5 5
43 5 5 5 5 5 5 5 5
43 5 5 5 5 5 5 5


Output: weak



29 24
19 18
38 2 1 8 13 6 4
47 15 16 5 2 1 7
34 22 9 3
44 9 10 11 3 1 7
33 18 4 2 3 3


Output: fair



24 6 12 4
25 3 19
36 4 25 2
19 11 1 3
15 9 3
37 5 27


Output: weak



26 13
26 13
26 13
26 13


Output: trick



50 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2


Output: weak



50 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
50 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2


Output: trick



50 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
49 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2


Output: fair

Requirements:


If you write a function, it can either read from the standard input or receive the input as a single string parameter. Also, the function can either print out the output or return it.
The program must be runnable in Linux using freely available software.
The source code must use only ASCII characters.
No standard loopholes.
CJam, 76 75 bytes

52,qN/{[~](52\-@/(\e_@{/(@+\e_}/\+}/2ew::m2f/0-,_!\26&gt;-"weak trick fair"S/=


Try it online in the CJam interpreter.