import java.util.Scanner; import java.util.List; import java.util.ArrayList; import java.util.Arrays; public class No1640 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); N = Integer.valueOf(scan.nextLine()); G = new ArrayList>(); for (int i=0; i < 2*N; i++) { G.add(new ArrayList()); } match = new int[2*N]; Arrays.fill(match, -1); used = new boolean[2*N]; for (int i=0; i < N; i++) { String[] s = scan.nextLine().split(" "); add_edge(i, Integer.valueOf(s[0]) + N - 1); add_edge(i, Integer.valueOf(s[1]) + N - 1); } int n = bipartite_matching(); if (n == N) { System.out.println("Yes"); for (int i=0; i < N; i++) { System.out.println(match[i] - N + 1); } } else { System.out.println("No"); } } private static int N; private static List> G; private static int[] match; private static boolean[] used; private static void add_edge(int u, int v) { G.get(u).add(v); G.get(v).add(u); } private static boolean dfs(int v) { used[v] = true; for (int u : G.get(v)) { int w = match[u]; if (w < 0 || (!used[w] && dfs(w))) { match[v] = u; match[u] = v; return true; } } return false; } private static int bipartite_matching() { int res = 0; for (int v=0; v < 2*N; v++) { if (match[v] < 0) { Arrays.fill(used, false); if (dfs(v)) { res++; } } } return res; } }