#include <bits/stdc++.h>
const int MAXN = 100005;
int n;
std::vector<int> edges[MAXN];
int visited[MAXN];
int distances[MAXN];
void dfs(int curr, int prev, int depth) {
  distances[curr] = depth;
  for (auto e : edges[curr]) {
    if (e == prev) continue;
    dfs(e, curr, depth + 1);
  }
}
int goFar(int curr) {
  dfs(curr, -1, 0);
  int highDist = -1;
  int bestNode = -1;
  for (int i = 1; i <= n; i++) {
    if (distances[i] > highDist) {
      highDist = distances[i];
      bestNode = i;
    }
  }
  return bestNode;
}
bool getPath(int curr, int prev, int goal, std::vector<int> &result) {
  result.push_back(curr);
  if (curr == goal) return true;
  for (auto e : edges[curr]) {
    if (e == prev) continue;
    if (getPath(e, curr, goal, result)) {
      return true;
    }
  }
  result.pop_back();
  return false;
}
std::vector<int> getTwos(int start) {
  std::vector<int> result;
  for (int e : edges[start]) {
    int prev = start;
    bool success = true;
    while (edges[e].size() != 1) {
      if (edges[e].size() > 2) {
        success = false;
        break;
      }
      int next = edges[e][0] == prev ? edges[e][1] : edges[e][0];
      prev = e;
      e = next;
    }
    if (success) {
      result.push_back(e);
    }
  }
  return result;
}
bool test(int first) {
  std::vector<int> v, nv;
  v.push_back(first);
  memset(visited, 0, sizeof(visited));
  while (!v.empty()) {
    for (auto n : v) {
      visited[n] = 1;
      for (auto e : edges[n]) {
        if (!visited[e]) {
          nv.push_back(e);
        }
      }
    }
    std::swap(v, nv);
    nv.clear();
    for (int i = 1; i < v.size(); i++) {
      if (edges[v[i]].size() != edges[v[0]].size()) {
        return false;
      }
    }
  }
  return true;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    edges[a].push_back(b);
    edges[b].push_back(a);
  }
  int n1 = goFar(1);
  int n2 = goFar(n1);
  int n3 = n1;
  std::vector<int> path;
  getPath(n1, -1, n2, path);
  dfs(path[path.size() / 2], -1, 0);
  auto twos = getTwos(path[path.size() / 2]);
  if (twos.size() == 1)
    n3 = twos[0];
  else {
    for (auto v : twos) {
      if (distances[v] != distances[n1]) {
        n3 = v;
        break;
      }
    }
  }
  int ans = -1;
  if (test(n1)) {
    ans = n1;
  } else if (test(n2)) {
    ans = n2;
  } else if (test(n3)) {
    ans = n3;
  } else if (test(path[path.size() / 2])) {
    ans = path[path.size() / 2];
  }
  printf("%d\n", ans);
  return 0;
}
