Problem: One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something. 

The following statement caught his attention: "Among any six people there are either three pairwise acquainted people or three pairwise unacquainted people"

Igor just couldn't get why the required minimum is 6 people. "Well, that's the same for five people, too!" — he kept on repeating in his mind. — "Let's take, say, Max, Ilya, Vova — here, they all know each other! And now let's add Dima and Oleg to Vova — none of them is acquainted with each other! Now, that math is just rubbish!"

Igor K. took 5 friends of his and wrote down who of them is friends with whom. Now he wants to check whether it is true for the five people that among them there are either three pairwise acquainted or three pairwise not acquainted people.

Input

The first line contains an integer m (0 ≤ m ≤ 10), which is the number of relations of acquaintances among the five friends of Igor's.

Each of the following m lines contains two integers ai and bi (1 ≤ ai, bi ≤ 5;ai ≠ bi), where (ai, bi) is a pair of acquainted people. It is guaranteed that each pair of the acquaintances is described exactly once. The acquaintance relation is symmetrical, i.e. if x is acquainted with y, then y is also acquainted with x.

Output

Print "FAIL", if among those five people there are no either three pairwise acquainted or three pairwise unacquainted people. Otherwise print "WIN".

Examples

Input

4
1 3
2 3
1 4
5 3


Output

WIN


Input

5
1 2
2 3
3 4
4 5
5 1


Output

FAIL

Solution (in JAVA):

Solution:
import java.util.*;

import java.math.BigInteger;

public class Watermelon {
	static int x;
	public static void main(String[] args)  {
	       Scanner sc=new Scanner(System.in);
	       int n=sc.nextInt();
	       int[][] arr=new int[n][2];
	       if(n==0){
	    	   System.out.println("WIN");
	    	   System.exit(0);
	       }
	       for(int i=0;i<n;i++)
	    	   for(int j=0;j<2;j++)
	    		   arr[i][j]=sc.nextInt();
	  
	       
	       int[][] marr=new int[5][5];
	       
	       for(int t=0;t<5;t++)
	    	   marr[t][t]=1;
	       for(int i=0;i<n;i++)
	       {    
	    	   
	    	   marr[arr[i][0]-1][arr[i][1]-1]=1;marr[arr[i][1]-1][arr[i][0]-1]=1;
	       }
           //   display(marr);	 
              ArrayList<Integer> list=new ArrayList<>();
              ArrayList<Integer> list1=new ArrayList<>();
              int count=0;
              int count1=0;
              for(int i=0;i<5;i++){
            	  count=0;
            	  count1=0;
            	  for(int j=0;j<5;j++){
            		  if(marr[i][j]==1) count++;
            		  if(marr[i][j]==0)count1++;
            	  }
            	  list.add(count);
            	  list1.add(count1);
              }
              int max=list.get(0);
              int max1=0;
              max1=list1.get(0);
              for(int i=0;i<list.size();i++){
            	  if(list.get(i)>max)
            		  max=list.get(i);
              }
              for(int i=0;i<list1.size();i++){
            	  if(list1.get(i)>max1)
            		  max1=list1.get(i);
              }
         //     System.out.println(max+" "+max1);
          //    System.out.println(list+" "+list1);
	       if(max==4||max1==3||max1==4||max==5)
	    	   System.out.println("WIN");
	       else
	    	   System.out.println("FAIL");
	} 
	
	private static int gcd(int a, int b)
	{
	    while (b > 0)
	    {
	    	int temp = b;
	        b = a % b; // % is remainder
	        a = temp;
	    }
	    return a;
	}
	private static int lcm(int a, int b)
	{
	    return a * (b / gcd(a, b));
	}
	static int[] toFractionPos(int x,int y){
		int a=gcd(x,y);
		int[] arr={x/a,y/a};
		//display(arr);
		return arr;
	}
    
	static void display(int[][] arr){
		for(int i=0;i<arr.length;i++){
			for(int j=0;j<arr[i].length;j++){
				System.out.print(arr[i][j]+" ");
			}
			System.out.println();
		}
		System.out.println();
	}
 
	 static void display(String[] arr){
			for(int i=0;i<arr.length;i++){
				
			}	
			System.out.println();
		
	 }
	 
		 static void display(int[] arr){
		
				System.out.print(arr[0]+"/"+arr[1]);
		System.out.println();
		 }
	 static void display(char[] arr){
		// System.out.println();
			for(int i=0;i<arr.length;i++){
				System.out.print(arr[i]+" ");
			}	
			System.out.println();
		
		  }
	 static String str(char[] carr){
		 String str="";
		 for(int i=0;i<carr.length;i++){
			    str=str+carr[i];
			}
		 return str;
	 }
	 
	}
class Count implements Comparable {
       int x;
       float i ;int j;
	Count(int x,float i,int j){
			this.j=j;
		  this.x=x;this.i=i;
		}	
		
		void display(){
			System.out.println(x+" "+j+" "+i);
		}
		@Override
		public int compareTo(Object o) {
		   Count co=(Count)o;
		   
		   if(co.i<this.i){
			   return 1;
		   }
		   else if(this.i<co.i){
			   return -1;
		   }
		   else
			   return 0;
		}
		
		
	}