#include <bits/stdc++.h>
using namespace std;
struct adj {
  int head[100001];
  int next[200001];
  int node[200001];
  int size;
  void add_edge(int a, int b) {
    ++size;
    next[size] = head[a];
    head[a] = size;
    node[size] = b;
  }
} a;
int deg[100001];
int dep[100001];
int f[100001];
bool path[100001];
int dep_h[100001];
int sum[100001];
int n;
int ans;
bool check_root(int s) {
  memset(dep_h, 0, sizeof(dep_h));
  for (int i = 1; i <= n; i++) {
    if (!dep_h[dep[i]])
      dep_h[dep[i]] = deg[i];
    else if (dep_h[dep[i]] != deg[i])
      return false;
  }
  return true;
}
void set_depth(int s) {
  memset(dep, 0, sizeof(dep));
  memset(f, 0, sizeof(f));
  queue<int> q;
  dep[s] = 1;
  for (q.push(s); !q.empty(); q.pop()) {
    int u = q.front();
    for (int i = a.head[u]; i; i = a.next[i])
      if (a.node[i] != f[u]) {
        dep[a.node[i]] = dep[u] + 1;
        f[a.node[i]] = u;
        q.push(a.node[i]);
      }
  }
}
void diameter(int &s, int &t) {
  ans = 0;
  int r;
  for (r = 1; r <= n && deg[r] != 1; r++)
    ;
  int d_m = 0;
  queue<int> q;
  memset(dep, 0, sizeof(dep));
  memset(f, 0, sizeof(f));
  for (q.push(r); !q.empty(); q.pop()) {
    int u = q.front();
    if (dep[u] > d_m) {
      d_m = dep[u];
      s = u;
    }
    for (int i = a.head[u]; i; i = a.next[i])
      if (a.node[i] != f[u]) {
        dep[a.node[i]] = dep[u] + 1;
        f[a.node[i]] = u;
        q.push(a.node[i]);
      }
  }
  d_m = 0;
  memset(dep, 0, sizeof(dep));
  memset(f, 0, sizeof(f));
  for (q.push(s); !q.empty(); q.pop()) {
    int u = q.front();
    if (dep[u] > d_m) {
      d_m = dep[u];
      t = u;
    }
    for (int i = a.head[u]; i; i = a.next[i])
      if (a.node[i] != f[u]) {
        dep[a.node[i]] = dep[u] + 1;
        f[a.node[i]] = u;
        q.push(a.node[i]);
      }
  }
  if (check_root(s)) {
    ans = s;
    return;
  }
}
void proce() {
  int s, t;
  diameter(s, t);
  if (ans) return;
  if (dep[t] & 1) {
    set_depth(t);
    if (check_root(t)) {
      ans = t;
      return;
    }
    ans = -1;
    return;
  }
  int radius = dep[t] >> 1;
  int d;
  for (d = t; f[d]; d = f[d]) path[d] = true;
  for (d = t; f[d]; d = f[d])
    if (dep[d] == radius) break;
  set_depth(d);
  if (check_root(d)) {
    ans = d;
    return;
  }
  int d_m = 100001;
  int p;
  for (int i = 1; i <= n; i++)
    if (dep[i] < d_m && deg[i] == 1) {
      p = i;
      d_m = dep[i];
    }
  set_depth(p);
  if (check_root(p)) {
    ans = p;
    return;
  }
  set_depth(t);
  if (check_root(t)) {
    ans = t;
    return;
  }
  ans = -1;
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    a.add_edge(x, y);
    a.add_edge(y, x);
    ++deg[x];
    ++deg[y];
  }
  proce();
  cout << ans << endl;
  return 0;
}
