#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1, mod = 1000000289, p1 = 1000000513;
vector<int> adj[N];
int unbalancedChildren[N] = {};
bool balanced[N] = {};
long long hashh[N] = {};
map<long long, int> childHash[N];
int n;
void dfs1(int cur, int p) {
  hashh[cur] = 1;
  balanced[cur] = 1;
  for (auto i : adj[cur]) {
    if (i == p) continue;
    dfs1(i, cur);
    hashh[cur] = (hashh[cur] + p1 * hashh[i]) % mod;
    childHash[cur][hashh[i]]++;
    if (!balanced[i]) ++unbalancedChildren[cur];
  }
  if (childHash[cur].size() > 1 || unbalancedChildren[cur]) balanced[cur] = 0;
}
void dfs2(int cur, int p) {
  long long parhashh = (hashh[p] - p1 * hashh[cur] % mod + mod) % mod;
  if (p && balanced[cur]) {
    bool parbal = 1;
    if (!balanced[p]) {
      if (unbalancedChildren[p])
        ++unbalancedChildren[cur], parbal = 0;
      else if (childHash[p][hashh[cur]] == 1) {
        if (childHash[p].size() > 2) ++unbalancedChildren[cur], parbal = 0;
      } else {
        if (childHash[p].size() > 1) ++unbalancedChildren[cur], parbal = 0;
      }
    }
    if (!childHash[cur].empty()) {
      auto it = *childHash[cur].begin();
      if (it.first == parhashh) {
        cout << cur << "\n";
        exit(0);
      }
    } else {
      if (parbal) {
        cout << cur << "\n";
        exit(0);
      }
    }
  }
  if (p) {
    hashh[cur] = (hashh[cur] + parhashh * p1) % mod;
    childHash[cur][parhashh]++;
    if (unbalancedChildren[cur] || childHash[cur].size() > 1) balanced[cur] = 0;
  }
  for (auto i : adj[cur]) {
    if (i == p) continue;
    dfs2(i, cur);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  dfs1(1, 0);
  if (balanced[1]) {
    cout << 1;
    return 0;
  }
  dfs2(1, 0);
  cout << -1;
  return 0;
}
