public void visit(int num){
		if(found) return;
		if(totalKey == 0) return;
		if(num == N){
			found = true;
			for(int i = 1; i < N; i++){
//				System.out.print(trace[i] + " ");
				ans += trace[i] + " ";
			}
//			System.out.println(trace[N]);
			ans += trace[N];
			return;
		}
		System.out.println(num);
		num++;
		for(int i = 1; i <= N; i++){
			if(!chest[i] && keys[key4Chest[i]] > 0){
				keys[key4Chest[i]] --;
				totalKey--;
				chest[i] = true;
				for(int j : chest2key.get(i)){
					keys[j]++;
					totalKey++;
				}
				trace[num] = i;
				visit(num);
				keys[key4Chest[i]] ++;
				totalKey++;
				chest[i] = false;
				for(int j : chest2key.get(i)){
					keys[j]--;
					totalKey--;
				}
			}
		}
	}