#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
vector<vector<int>> edges;
void Load() {
  scanf("%d", &n);
  edges.resize(n + 1);
  for (int i = 1; i <= n - 1; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    edges[u].push_back(v);
    edges[v].push_back(u);
  }
}
struct State {
  State(int u, int f) : u(u), from(f) {}
  int u;
  int from;
};
vector<int> GetDegData(int root, int par) {
  map<int, int> layer_deg;
  map<int, int> node_layer;
  queue<State> q;
  layer_deg[0] = edges[root].size();
  node_layer[root] = 0;
  q.push({root, par});
  while (!q.empty()) {
    State s = q.front();
    q.pop();
    for (int v : edges[s.u]) {
      if (v == s.from) continue;
      int layer = node_layer[s.u] + 1;
      if (layer_deg.count(layer) == 0) {
        layer_deg[layer] = edges[v].size();
      } else if ((int)edges[v].size() != layer_deg[layer]) {
        return {-1};
      }
      node_layer[v] = layer;
      q.push({v, s.u});
    }
  }
  vector<int> ret;
  for (const auto& elt : layer_deg) {
    ret.push_back(elt.second);
  }
  return ret;
}
int FindLeaf(int ban, int cur) {
  while (edges[cur].size() != 1) {
    int tmp = cur;
    cur = edges[cur][0] == ban ? edges[cur][1] : edges[cur][0];
    ban = tmp;
  }
  return cur;
}
int Works(int M) {
  map<vector<int>, pair<int, int>> deg_data;
  for (int i : edges[M]) {
    vector<int> data = GetDegData(i, M);
    if (data.size() > 0 && data[0] == -1) {
      return -1;
    }
    deg_data[data] = {deg_data[data].first + 1, i};
  }
  if (deg_data.size() > 2) return -1;
  if (deg_data.size() == 1) return M;
  for (const auto& elt : deg_data) {
    if (*max_element((elt.first).begin(), (elt.first).end()) <= 2 &&
        elt.second.first == 1) {
      return FindLeaf(M, elt.second.second);
    }
  }
  return -1;
}
int Solve() {
  if (n == 1) return 1;
  int A;
  for (int i = 1; i <= n; ++i) {
    if (edges[i].size() == 1) {
      A = i;
      break;
    }
  }
  if (Works(A) != -1) return A;
  vector<int> Adist(n + 1, -1), closeA(n + 1, -1);
  queue<State> q;
  Adist[A] = 0;
  closeA[A] = -1;
  q.push({edges[A][0], A});
  while (!q.empty()) {
    State s = q.front();
    q.pop();
    Adist[s.u] = Adist[s.from] + 1;
    closeA[s.u] = s.from;
    for (int v : edges[s.u]) {
      if (v == s.from) continue;
      q.push({v, s.u});
    }
  }
  int maxdist = *max_element((Adist).begin(), (Adist).end());
  int B;
  for (int i = 1; i <= n; ++i) {
    if (Adist[i] == maxdist) {
      B = i;
      break;
    }
  }
  if (Works(B) != -1) return B;
  if (maxdist % 2 == 1) return -1;
  int M = B;
  for (int i = 1; i <= maxdist / 2; ++i) {
    M = closeA[M];
  }
  return Works(M);
}
int main() {
  Load();
  printf("%d\n", Solve());
}
