static void bfs(int node, ArrayList<ArrayList<Integer>> g, boolean[] visited, int[] dist){
		if(visited[node]) return;
		Queue<Integer> toDo = new LinkedList<Integer>();
		dist[node]=0;
		toDo.add(node);
		while(!toDo.isEmpty()){
			int n = toDo.poll();
			visited[n]=true;
			for(int neighbor:g.get(n)){
				if(!visited[neighbor]){
					dist[neighbor]=dist[n]+1;
					toDo.add(neighbor);
				}
			}
		}
	}