#include using namespace std; constexpr long long shift = 1LL<<32; unordered_map dp; vector> Es(100000, vector()); bool dfs(int a, int b){ long long ab = a * shift + b; if (dp.count(ab) > 0) return dp[ab]; for (auto c : Es[b]){ if (c == a) continue; if (not dfs(b, c)){ dp[ab] = true; return true; } } dp[ab] = false; return false; } int main(){ cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; for (int i = 1; i < N; ++i){ int a, b; cin >> a >> b; Es[a-1].push_back(b-1); Es[b-1].push_back(a-1); } for (int a = 0; a < N; ++a){ for (auto b : Es[a]){ dfs(a, b); } } vector ans; for (int v = 0; v < N; ++v){ bool v_wins = true; for (auto u : Es[v]){ if (not dp[v * shift + u]){ v_wins = false; break; } } if (v_wins) ans.push_back(v + 1); } cout << ans.size() << '\n'; for (auto v : ans) cout << v << '\n'; return 0; }