#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
namespace Bigcat {
template <typename T>
inline void max_s(T& a, const T& b) {
  a = max(a, b);
}
template <typename T>
inline void min_s(T& a, const T& b) {
  a = min(a, b);
}
template <typename T>
void sort_v(T& x) {
  sort(x.begin(), x.end());
}
template <typename T>
void erase_dup(T& x) {
  x.erase(unique(x.begin(), x.end()), x.end());
}
template <typename T, typename V>
int pos_l(const T& x, const V& v) {
  return lower_bound(x.begin(), x.end(), v) - x.begin();
}
template <typename T, typename V>
int pos_u(const T& x, const V& v) {
  return upper_bound(x.begin(), x.end(), v) - x.begin();
}
inline unsigned rand_g() {
  static mt19937 mt_rand((int)time(0));
  return mt_rand();
}
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using PII = pair<int, int>;
using VPII = vector<PII>;
}  // namespace Bigcat
using namespace Bigcat;
const LL base = LL(1e9 + 7);
const LL INFL = 1LL << 62;
const int INF = 1 << 30;
const int MAX = int(1e5 + 100);
struct Node {
  int x, y, w;
};
bool operator<(const Node& n0, const Node& n1) { return n0.x < n1.y; }
int sz[MAX];
VI gr[MAX];
void dfs_sz(int v, int par) {
  sz[v] = 1;
  for (auto x : gr[v]) {
    if (x == par) continue;
    dfs_sz(x, v);
    sz[v] += sz[x];
  }
}
int centr(int v, int par, int need) {
  for (int x : gr[v]) {
    if (x == par) continue;
    if (sz[x] > need / 2) return centr(x, v, need);
  }
  return v;
}
int zc[MAX];
bool check_one(int v, int par, int dep) {
  for (int u : gr[v]) {
    if (u == par) continue;
    if (!check_one(u, v, dep + 1)) return false;
  }
  if (zc[dep] < 0) {
    zc[dep] = gr[v].size();
  } else {
    if (zc[dep] != gr[v].size()) return false;
  }
  return true;
}
bool check(int cc) {
  memset(zc, -1, sizeof(zc));
  bool f = check_one(cc, -1, 0);
  return f;
}
void solve1() {
  LL result = 0;
  int n;
  cin >> n;
  for (int i = 0; i < (int)(n - 1); i++) {
    int a, b;
    cin >> a >> b;
    gr[a].push_back(b);
    gr[b].push_back(a);
  }
  dfs_sz(1, -1);
  int c = centr(1, -1, sz[1]);
  if (check(c)) {
    cout << c << endl;
    return;
  }
  map<int, int> ss, ss2;
  int ts = 0;
  for (int v : gr[c]) {
    bool straight = true;
    int dep = 0;
    int par = c;
    int ov = v;
    while (gr[v].size() > 1) {
      if (gr[v].size() != 2) {
        straight = false;
        break;
      }
      ++dep;
      for (int u : gr[v]) {
        if (u != par) {
          par = v;
          v = u;
          break;
        }
      }
    }
    if (straight) {
      ++ts;
      ss[dep]++;
      ss2[dep] = v;
    }
  }
  if (ts == 1 || ts == gr[c].size()) {
    if (ss.size() <= 2) {
      auto i = ss.begin();
      if (i->second != 1) {
        ++i;
      }
      if (i != ss.end()) {
        int t = ss2[i->first];
        if (check(t)) {
          cout << t << endl;
          return;
        }
      }
    }
  }
  cout << -1 << endl;
}
const bool _multi_test = false;
const int _inId = 1;
const int _outId = 0;
void io_init(char* s0) {
  string path(s0);
  int a = path.find("build\\");
  int b = path.find("Release\\");
  if (a > 0 && b > a) {
    path = path.substr(0, a) + path.substr(a + 6, b - a - 6);
  } else
    path = "";
  if (_inId > 0) {
    cerr << "redirect stdin to input " << _inId << endl;
    string s = "input";
    s += to_string(_inId);
    s += ".txt";
    if (path != "") s = path + s;
    auto r = freopen(s.c_str(), "r", stdin);
    if (r == nullptr) {
      cerr << "invalid input file " << s << endl;
      ;
      r = freopen("CON", "r", stdin);
    }
  }
  if (_outId > 0) {
    cerr << "redirect stdout to stdout " << _outId << endl;
    string s = "stdout";
    s += to_string(_outId);
    s += ".txt";
    if (path != "") s = path + s;
    auto r = freopen(s.c_str(), "w", stdout);
    if (r == nullptr) {
      cerr << "invalid output file " << s << endl;
      ;
      r = freopen("CON", "w", stdout);
    }
  }
}
const bool _local_test = false;
void solve() {
  int t = 1;
  if (_multi_test) cin >> t;
  if (_local_test) cerr << " now base " << base << endl;
  for (int i = 0; i < t; ++i) {
    if (_local_test) cerr << " tasks: " << i + 1 << endl;
    solve1();
  }
  int x = 1;
}
signed main(signed argc, char* argv[]) {
  if (_local_test) {
    if (argc == 1) {
      io_init(argv[0]);
    }
  }
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin.exceptions(cin.failbit);
  cout.precision(11);
  solve();
}
