// [NWERC'14] Double Edge, by Jan Kuipers #include #include using namespace std; vector > conn; int next_freq; vector freq1, freq2; void solve(int n, int freq, int parent) { freq1[n] = next_freq++; freq2[n] = freq; for (int i=0; i> N; conn = vector >(N); freq1 = freq2 = vector(N); for (int i=0; i> a >> b; a--; b--; conn[a].push_back(b); conn[b].push_back(a); } if (N == 2) { cout << "0 1" << endl; cout << "0 1" << endl; } else { next_freq = 1; solve(0, 0, -1); for (int i=0; i