#include <bits/stdc++.h>
using namespace std;
int n, q[100010], f[100010], pre[100010], tag[100010], flag[100010];
vector<int> to[100010];
void add(int a, int b) {
  to[a].push_back(b);
  to[b].push_back(a);
}
int bfs(int S) {
  memset(f, 0, sizeof(f));
  memset(pre, 0, sizeof(pre));
  int l = 1, r = 2, pos = S;
  q[1] = S;
  f[S] = 1;
  while (l < r) {
    int x = q[l++], y;
    for (int i = 0; i < to[x].size(); i++) {
      y = to[x][i];
      if (f[y]) continue;
      f[y] = f[x] + 1;
      pre[y] = x;
      q[r++] = y;
      if (f[y] > f[pos]) pos = y;
    }
  }
  return pos;
}
int aa = 0;
int bfs2(int S) {
  memset(f, 0, sizeof(f));
  int l = 1, r = 2, pos = S;
  q[1] = S;
  f[S] = 1;
  while (l < r) {
    int x = q[l++], y;
    for (int i = 0; i < to[x].size(); i++) {
      y = to[x][i];
      if (f[y] || flag[y] || to[y].size() > 2) continue;
      if (to[y].size() == 1) return y;
      f[y] = f[x] + 1;
      q[r++] = y;
    }
  }
  return pos;
}
bool check(int x, int fa, int dep) {
  if (!tag[dep])
    tag[dep] = to[x].size();
  else if (tag[dep] != to[x].size())
    return 0;
  for (int i = 0; i < to[x].size(); i++) {
    int y = to[x][i];
    if (y == fa) continue;
    if (!check(y, x, dep + 1)) return 0;
  }
  return 1;
}
bool check(int x) {
  memset(tag, 0, sizeof(tag));
  return check(x, 0, 0);
}
int main() {
  int a, b, A, B;
  scanf("%d", &n);
  for (int i = 1; i < n; i++)
    scanf("%d%d", &a, &b), add(a, b), aa = (aa ? aa : a);
  A = bfs(1);
  B = bfs(A);
  if (check(A)) {
    printf("%d\n", A);
    return 0;
  }
  if (check(B)) {
    printf("%d\n", B);
    return 0;
  }
  if (f[B] & 1) {
    int tmp = (f[B] - 1) / 2;
    for (int x = B; x; x = pre[x]) flag[x] = 1;
    for (int i = 1; i <= tmp; i++) B = pre[B];
    if (check(B)) {
      printf("%d\n", B);
      return 0;
    }
    int pos = bfs2(B);
    if (check(pos)) {
      printf("%d\n", pos);
      return 0;
    }
  }
  printf("-1\n");
  return 0;
}
