#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n, cnt = 0, degree[maxn], hd[maxn], val[maxn], ls, rs, mid, mx, num,
       q[maxn], dis[maxn], fa[maxn], fx, flag, a, b;
struct node {
  int u, to, next;
} edge[maxn << 1];
void add(int u, int v) {
  edge[++cnt].to = v;
  edge[cnt].u = u;
  edge[cnt].next = hd[u];
  hd[u] = cnt;
  degree[v]++;
}
int check(int x) {
  int flag = 1, head = 0, tail = 0;
  memset(val, 0, sizeof(val));
  q[++tail] = x;
  dis[x] = 0;
  fa[x] = 0;
  while (head < tail) {
    int h = q[++head], d = dis[h];
    if (val[d] && val[d] != degree[h]) {
      return flag = 0;
    }
    val[d] = degree[h];
    for (int i = hd[h]; i; i = edge[i].next)
      if (edge[i].to != fa[h])
        fa[edge[i].to] = h, dis[edge[i].to] = d + 1, q[++tail] = edge[i].to;
  }
  return flag;
}
void dfs(int x) {
  int head = 0, tail = 0;
  q[++tail] = x, dis[x] = 0, fa[x] = 0;
  while (head < tail) {
    int h = q[++head], d = dis[h];
    if (d > mx) {
      mx = dis[h];
      if (!fx)
        ls = h;
      else
        rs = h;
    }
    for (int i = hd[h]; i; i = edge[i].next)
      if (edge[i].to != fa[h])
        fa[edge[i].to] = h, dis[edge[i].to] = d + 1, q[++tail] = edge[i].to;
  }
}
void dfs1(int x) {
  int head = 0, tail = 0;
  q[++tail] = x, dis[x] = 0, fa[x] = 0;
  while (head < tail) {
    int h = q[++head], d = dis[h];
    if (h == rs) {
      int step = 0;
      while (1) {
        h = fa[h], step++;
        if (step == mx) {
          mid = h;
          return;
        }
      }
    }
    for (int i = hd[h]; i; i = edge[i].next)
      if (edge[i].to != fa[h])
        fa[edge[i].to] = h, dis[edge[i].to] = d + 1, q[++tail] = edge[i].to;
  }
}
void dfs2(int x) {
  int head = 0, tail = 0;
  q[++tail] = x, dis[x] = 0, fa[x] = 0;
  while (head < tail) {
    int h = q[++head], d = dis[h];
    if (degree[h] != 2 && h != mid) {
      if (degree[h] == 1 && dis[h] < num) num = dis[h], ls = h;
      continue;
    }
    for (int i = hd[h]; i; i = edge[i].next)
      if (edge[i].to != fa[h])
        fa[edge[i].to] = h, dis[edge[i].to] = d + 1, q[++tail] = edge[i].to;
  }
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) cin >> a >> b, add(a, b), add(b, a);
  mx = -1;
  dfs(1);
  if (check(ls)) {
    cout << ls << endl;
    return 0;
  }
  mx = -1;
  fx = 1;
  dfs(ls);
  if (check(rs)) {
    cout << rs << endl;
    return 0;
  }
  if (mx < 0 || (mx & 1)) {
    cout << -1 << endl;
    return 0;
  }
  mx /= 2;
  dfs1(ls);
  if (check(mid)) {
    cout << mid << endl;
    return 0;
  }
  num = maxn;
  dfs2(mid);
  if (ls && check(ls))
    cout << ls << endl;
  else
    cout << -1 << endl;
}
