#include <bits/stdc++.h>
using namespace std;
const int M = 2e5 + 10;
int n, head[M], ver[M], nxt[M], deg[M], tot, path[M], st, ed, vis[M], num,
    mid[M], d[M], maxdep;
vector<int> vt[M];
queue<int> q;
void add(int x, int y) {
  nxt[++tot] = head[x];
  head[x] = tot;
  ver[tot] = y;
}
int bfs(int p) {
  for (int i = 1; i <= n; i++) path[i] = vis[i] = 0;
  q.push(p);
  vis[p] = 1;
  int cnt = 0, x;
  while (cnt != n) {
    x = q.front();
    q.pop();
    cnt++;
    for (int i = head[x]; i; i = nxt[i])
      if (!vis[ver[i]]) path[ver[i]] = x, vis[ver[i]] = 1, q.push(ver[i]);
  }
  return x;
}
void dfs(int x, int fa, int dep) {
  vis[x] = 1;
  vt[dep].push_back(x);
  maxdep = max(maxdep, dep);
  for (int i = head[x]; i; i = nxt[i])
    if (ver[i] != fa) dfs(ver[i], x, dep + 1);
}
int check(int x) {
  for (int i = 1; i <= n; i++) vis[i] = 0, vt[i].clear();
  dfs(x, -1, 1);
  for (int i = 1; i <= maxdep; i++)
    for (int j = 1; j < vt[i].size(); j++)
      if (deg[vt[i][j]] != deg[vt[i][j - 1]]) return 0;
  return 1;
}
int fnd(int x, int fa) {
  if (deg[x] > 2) return -1;
  d[x] = d[fa] + 1;
  if (deg[x] == 1)
    return x;
  else
    for (int i = head[x]; i; i = nxt[i])
      if (ver[i] != fa) return fnd(ver[i], x);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
    deg[x]++;
    deg[y]++;
  }
  st = bfs(1);
  ed = bfs(st);
  if (check(st)) return 0 * printf("%d\n", st);
  if (check(ed)) return 0 * printf("%d\n", ed);
  int now = ed;
  while (now != 0) {
    mid[++num] = now;
    d[now] = -1;
    now = path[now];
  }
  if (num & 1 && check(mid[num / 2 + 1]))
    return 0 * printf("%d\n", mid[num / 2 + 1]);
  if (num & 1) {
    int last = -1, mn = M;
    for (int i = head[mid[num / 2 + 1]]; i; i = nxt[i]) {
      int y = ver[i];
      if (d[y] == -1) continue;
      int res = fnd(y, mid[num / 2 + 1]);
      if (res != -1 && d[res] < mn) mn = d[res], last = res;
    }
    if (last != -1 && check(last)) return 0 * printf("%d\n", last);
  }
  printf("-1\n");
  return 0;
}
