	import java.util.ArrayList;
import java.util.Arrays;
	
import java.util.List;

	import ru.ifmo.testlib.*;
import ru.ifmo.testlib.Outcome.Type;
	
	
	
	public class Check implements Checker {
	    
		class Event implements Comparable<Event>{
			int s, t;
			public int compareTo(Event arg0) {
				if (s == arg0.s)
					return t - arg0.t;
				else
					return s - arg0.s;
			}
		}
		
		public int max(int a, int b){
			if(a > b)
				return a;
			return b;
		}
		public int min(int a, int b){
			if(a < b)
				return a;
			return b;
		}
		@Override
	    public Outcome test(InStream inf, InStream ouf, InStream ans) {
	        try {
	        int m = ouf.nextInt();
	        int jans = ans.nextInt();
	        if(m == -1 && m != jans)    
	        	return new Outcome(Type.WA, "Contestant thinks that it is impossible");
	        if(m == -1 && jans == -1)
	        	return new Outcome(Type.OK, "Yes, it is impossible");
	        int k = ouf.nextInt();
	        int p[] = new int [m + k];
	        for(int i = 0; i < m + k; i++)
	        	p[ouf.nextInt() - 1] = i;
	        int n = inf.nextInt();
	        if(m + k != n)
	        	return new Outcome(Type.WA, "There is wrong amount of gods");
	        List<Integer>[] test;
	        test = new ArrayList[n];
			for(int i = 0; i < n; i++)
				test[i] = new ArrayList<Integer>();
			for(int i = 0; i < n; i++){
	        	int k_i = inf.nextInt();
	        	for(int j = 0; j < k_i; j++){
	        		int v = inf.nextInt() - 1;
	        		test[p[i]].add(p[v]);
	        	}
	        }
	        //Проверка на двудольность
	        int ok = 1;
	        for(int i = 0; i < m; i++){
	        	for(int j = 0; j < test[i].size(); j++)
	        		if(test[i].get(j) < m)
	        			ok = 0;
	        }
	        for(int i = m; i < n; i++){
	        	for(int j = 0; j < test[i].size(); j++)
	        		if(test[i].get(j) >= m)
	        			ok = 0;
	        }
	        if(ok == 0)
	        	return new Outcome(Type.WA, "There is not bilobed graph");
	     
	        //Проверка на пересечение
	        int prevmax = 0;
	        for(int i = 0; i < m; i++){
	        	int curmax = 0;
	        	int curmin = n + 5;
	        	for(int j = 0; j < test[i].size(); j++){
	        		curmax = max(curmax, test[i].get(j));
	        		curmin = min(curmin, test[i].get(j));
	        	}
	        	if(curmin < prevmax)
	        		ok = 0;
	        	prevmax = curmax;
	        }
	        if(ok == 0)
	        	return new Outcome(Type.WA, "Gods will meet each other:(");
	        if (jans == -1) {
	        	return new Outcome(Type.FAIL, "Fail");
	        }
	        return new Outcome(Type.OK, "Yeah, man, you're the best!!!");
	      } catch (Throwable e) {
	            return new Outcome(Type.PE, "Something went wrong!");
	      }
	    }
	}
