#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool updmin(T &a, T b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
bool updmax(T &a, T b) {
  if (b > a) {
    a = b;
    return 1;
  }
  return 0;
}
struct Hashstate {
  const static long long hashmod = 100000000ll * 100000000ll + 61, a = 61;
  long long state;
  Hashstate(long long x = hashmod) { state = x; }
  Hashstate add(int x) {
    if (state < 0) return -1;
    return (state * a % hashmod + 1ll * x * x % hashmod) % hashmod;
  }
};
Hashstate merge(Hashstate a, Hashstate b) {
  if (a.state >= Hashstate::hashmod) return b;
  if (b.state >= Hashstate::hashmod) return a;
  if (a.state < 0 || b.state < 0 || a.state != b.state) {
    return -1;
  }
  return a;
}
int main() {
  int n, u, v;
  cin >> n;
  vector<vector<int>> graph(n);
  for (int i = 1; i < n; i++) {
    cin >> u >> v;
    u--, v--;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  graph[0].push_back(-1);
  vector<Hashstate> a(n), b(n), c(n);
  function<void(int, int)> dfs = [&](int rt, int fa) {
    for (int i = 0; i < graph[rt].size(); i++) {
      if (graph[rt][i] == fa) {
        swap(graph[rt][i], graph[rt][0]);
      } else {
        dfs(graph[rt][i], rt);
        a[rt] = merge(a[rt], a[graph[rt][i]].add(graph[graph[rt][i]].size()));
      }
    }
  };
  dfs(0, -1);
  function<void(int)> dfs2 = [&](int rt) {
    c[rt] = merge(a[rt], b[rt]);
    vector<Hashstate> temp1(graph[rt].size()), temp2(graph[rt].size() + 1);
    for (int i = 1; i < graph[rt].size(); i++) {
      temp1[i] =
          merge(temp1[i - 1], a[graph[rt][i]].add(graph[graph[rt][i]].size()));
    }
    for (int i = graph[rt].size() - 1; i >= 1; i--) {
      temp2[i] =
          merge(temp2[i + 1], a[graph[rt][i]].add(graph[graph[rt][i]].size()));
    }
    for (int i = 1; i < graph[rt].size(); i++) {
      b[graph[rt][i]] = merge(b[rt], merge(temp1[i - 1], temp2[i + 1]))
                            .add(graph[rt].size() - (rt == 0));
    }
    for (int i = 1; i < graph[rt].size(); i++) {
      dfs2(graph[rt][i]);
    }
  };
  dfs2(0);
  for (int i = 0; i < n; i++) {
    if (c[i].state >= 0) {
      cout << i + 1 << endl;
      exit(0);
    }
  }
  cout << -1 << endl;
  return 0;
}
