import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int list[] = new int[N]; HashMap> pathMap = new HashMap<>(); HashSet checkList = new HashSet<>(); for(int i=0; i array = pathMap.get(a); if( array == null) { array = new ArrayList<>(); array.add(i); pathMap.put(a, array); } else { array.add(i); pathMap.put(a, array); checkList.add(i); } } scan.close(); for(int t : checkList) { ArrayList array = pathMap.get(t); if(array == null) continue; if(array.size() >= 2) { int from = array.get(0); int to = array.get(array.size()-1); for(int i=from; i<=to; i++) { list[i] = t; } } } for(int i=0; i