#include #include #include int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); int N; std::cin >> N; std::vector> g(N); for (int i = 0, a, b; i < N - 1; i++) { std::cin >> a >> b, a--, b--, g[a].push_back(b), g[b].push_back(a); } std::vector win(N); std::vector one(N, 0); // 子供に勝木が何個あるか auto dp = [&](auto&& self, const int s, const int p) -> bool { for (const int to : g[s]) { if (to == p) { continue; } one[s] += self(self, to, s); } return win[s] = one[s] == 0; }; dp(dp, 0, -1); std::vector ans; auto dp2 = [&](auto&& self, const int s, const int p) -> void { if (p == -1) { if (win[s]) { ans.push_back(s); } } else { const int pone = one[p] - win[s]; win[p] = pone == 0, one[s] += win[p]; if (one[s] == 0) { ans.push_back(s); } } for (const int to : g[s]) { if (to == p) { continue; } self(self, to, s); } }; dp2(dp2, 0, -1); std::cout << ans.size() << "\n"; std::sort(ans.begin(), ans.end()); for (const int e : ans) { std::cout << e + 1 << "\n"; } return 0; }