#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 3;
const long long mod = 1e9 + 7;
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int INFi = 0x7f7f7f7f;
int n, ans = -1, okk[N];
vector<int> adj[N];
map<unsigned long long, int> hm[N], okm[N];
unsigned long long hsh[N];
bool ch(int x, int p) {
  bool ok = 1;
  unsigned long long h = 0;
  for (auto it : adj[x]) {
    if (it == p) continue;
    if (h == 0) h = hsh[it];
    if (hsh[it] != h) ok = 0;
    ok &= okk[it];
  }
  return ok;
}
void dfs(int x, int p) {
  hsh[x] = 1;
  for (auto it : adj[x]) {
    if (it == p) continue;
    dfs(it, x);
    hsh[x] += hsh[it] * 39;
    okm[x][okk[it]]++;
    hm[x][hsh[it]]++;
  }
  okk[x] = ch(x, p);
}
void reroot(int x, int p) {
  if (p) {
    hsh[p] -= hsh[x] * 39;
    hm[p][hsh[x]]--;
    if (hm[p][hsh[x]] == 0) hm[p].erase(hsh[x]);
    okm[p][okk[x]]--;
    if (okm[p][okk[x]] == 0) okm[p].erase(okk[x]);
    okk[p] = (hm[p].size() <= 1) & (okm[p][0] == 0);
    hsh[x] += hsh[p] * 39;
    hm[x][hsh[p]]++;
    okm[x][okk[p]]++;
    okk[x] = (hm[x].size() <= 1) & (okm[x][0] == 0);
  }
  if (okk[x]) ans = x;
  for (auto it : adj[x]) {
    if (it == p) continue;
    reroot(it, x);
  }
  if (p) {
    hsh[x] -= hsh[p] * 39;
    hm[x][hsh[p]]--;
    if (hm[x][hsh[p]] == 0) hm[x].erase(hsh[p]);
    okm[x][okk[p]]--;
    if (okm[x][okk[p]] == 0) okm[x].erase(okk[p]);
    okk[x] = (hm[x].size() <= 1) & (okm[x][0] == 0);
    hsh[p] += hsh[x] * 39;
    hm[p][hsh[x]]++;
    okm[p][okk[x]]++;
    okk[p] = (hm[p].size() <= 1) & (okm[p][0] == 0);
  }
}
void solve() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1, 0);
  reroot(1, 0);
  cout << ans << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout << setprecision(15);
  ;
  int test = 1;
  for (int i = 1; i <= test; i++) {
    solve();
  }
}
