#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
int n, p[N];
vector<int> v[N];
map<vector<int>, int> m;
int ID = 1;
bool ok;
void dfs(int node, int pnode, int dep, pair<int, int> &f, int fn) {
  p[node] = pnode;
  if (v[node].size() == 1) {
    if (fn)
      f = max(f, make_pair(dep, node));
    else
      f = min(f, make_pair(dep, node));
  }
  for (auto &i : v[node]) {
    if (i == pnode) continue;
    dfs(i, node, dep + 1, f, fn);
  }
}
int check(int node, int pnode) {
  vector<int> h;
  for (auto &i : v[node]) {
    if (i == pnode) continue;
    h.push_back(check(i, node));
  }
  sort(h.begin(), h.end());
  if (h.size() > 0 && h[0] != h.back()) ok = 0;
  if (m.find(h) != m.end()) return m[h];
  return m[h] = ID++;
}
bool check(int node) {
  ok = 1;
  check(node, 0);
  return ok;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  pair<int, int> f = {0, 1};
  dfs(1, 0, 0, f, 1);
  if (check(f.second)) return cout << f.second << endl, 0;
  f = {0, f.second};
  dfs(f.second, 0, 0, f, 1);
  if (check(f.second)) return cout << f.second << endl, 0;
  int center = f.second;
  for (int i = 0; i < f.first / 2; i++) {
    center = p[center];
  }
  if (check(center)) return cout << center << endl, 0;
  f = {1e9, 1e9};
  dfs(center, 0, 0, f, 0);
  if (check(f.second)) return cout << f.second << endl, 0;
  cout << -1 << endl;
}
