public Variables backtrack(Variables vars, Constraints con, Domain dom){
		if(vars.isComplete()){
			return vars;
		}
		
//		Node var = vars.getUnsetNode();
		Node var = vars.MRV(con,dom);
		
		if(var==null){
			return null;
		}
		
//		for(int i: dom.nextValues(var, vars, con)){
		for(int i: dom.LCV(var, vars, con)){
			this.numOfCalls++;
//			System.out.println("trying "+var+" with value "+i);

			if(!var.blackList.contains(i)&&con.isLegal(var, vars, i)){

				var.set(i);
//				System.out.println("legal \n"+vars+" added "+var);
				if(forward(vars,con,dom,var)){
					Variables result = backtrack(vars,con,dom);
					if(result!=null){
						return result;
					}
				}
			}
			var.unset();
			undoForward(vars);
			
		}
		return null;
	}