#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> vec[100100];
int C[100100];
int P[100100];
vector<int> level[100100];
int bug;
int len;
void putDfs(int u, int p, int lvl) {
  level[lvl].push_back(vec[u].size());
  for (int i = 0; i < vec[u].size(); i++) {
    int v = vec[u][i];
    if (v == p) continue;
    putDfs(v, u, lvl + 1);
  }
}
int isOk(int src) {
  for (int i = 1; i <= n; i++) level[i].clear();
  putDfs(src, -1, 1);
  for (int i = 1; i <= n; i++) {
    if (level[i].size() == 0) continue;
    sort(level[i].begin(), level[i].end());
    if (level[i].front() != level[i].back()) return 0;
  }
  return 1;
}
int getFar(int src) {
  int dis[100100] = {0};
  int visit[100100] = {0};
  for (int i = 1; i <= n; i++) P[i] = i;
  queue<int> q;
  q.push(src);
  visit[src] = 1;
  while (q.size()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < vec[u].size(); i++) {
      int v = vec[u][i];
      if (visit[v]) continue;
      visit[v] = 1;
      q.push(v);
      P[v] = u;
      dis[v] = dis[u] + 1;
    }
  }
  int idx = src;
  for (int i = 1; i <= n; i++) {
    if (dis[i] > dis[idx]) idx = i;
  }
  return idx;
}
int isPer(int u, int p, int lvl) {
  if (vec[u].size() > 2) return -1;
  if (vec[u].size() == 1) {
    len = lvl;
    return u;
  }
  for (int i = 0; i < vec[u].size(); i++) {
    int v = vec[u][i];
    if (v == p) continue;
    return isPer(v, u, lvl + 1);
  }
}
int getMiddle() {
  if (n <= 2) return 1;
  int a = getFar(1);
  int b = getFar(a);
  if (isOk(a)) return a;
  if (isOk(b)) return b;
  vector<int> path;
  int uu = b;
  while (P[uu] != uu) {
    path.push_back(uu);
    uu = P[uu];
  }
  path.push_back(a);
  if (path.size() % 2 == 0) return -1;
  int ix = path.size() / 2;
  int mid = path[path.size() / 2];
  if (isOk(mid)) return mid;
  int lll = n + n;
  int iii = -1;
  for (int i = 0; i < vec[mid].size(); i++) {
    int ver = vec[mid][i];
    len = 0;
    int per = isPer(ver, mid, 1);
    if (per != -1) {
      if (iii == -1) {
        iii = per;
        lll = len;
      } else if (len < lll) {
        lll = len;
        iii = per;
      }
    }
  }
  if (iii != -1 && isOk(iii)) return iii;
  return -1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    vec[u].push_back(v);
    vec[v].push_back(u);
    if (bug == 0) bug = u;
  }
  printf("%d\n", getMiddle());
  return 0;
}
