import java.awt.Frame; import java.net.NetworkInterface; import java.util.*; public class Main { static long gcd(long a,long b){ return b == 0 ? a : gcd(b, a%b); } static long lcm(long a, long b){ return a*b/gcd(a, b); } static int[] dx = {0,1,0,-1};//→↓←↑ static int[] dy = {1,0,-1,0}; static class Pair{ long weight,value; public Pair(long weight,long value) { // TODO Auto-generated constructor stub this.weight = weight; this.value = value; } } static boolean is_kadomatsu(int a,int b, int c){ if(a==b || b==c || a==c) return false; if( (ab && b>c) )return false; return true; } static boolean dfs(int used,int now){ //勝ちでtrue if( (n-Integer.bitCount(used))<3) return false; boolean win = false; for(int i=0;i>i)&1)==0 && ((used>>j)&1)==0 && ((used>>k)&1)==0 ){ if(is_kadomatsu(kado[i], kado[j], kado[k])){ if(dfs(used+(1<