#include <bits/stdc++.h>
using namespace std;
struct InputReader {
  char buf[1048576];
  int p;
  inline InputReader() { p = 1048576; }
  inline void Flush() {
    p = 0;
    fread(buf, 1, 1048576, stdin);
  }
  inline char C() {
    if (p >= 1048576) Flush();
    return buf[p++];
  }
  inline char Readnum() {
    char ch = C();
    while (!isdigit(ch) && ch != '-') ch = C();
    return ch;
  }
  inline void Readalpha(char &c) {
    c = C();
    while (!isalpha(c)) c = C();
  }
  int operator()() {
    int ans = 0, fu = 1;
    char ch = Readnum();
    if (ch == '-') fu = -1, ch = C();
    while (ch >= '0' && ch <= '9') {
      ans = ans * 10 + ch - '0';
      ch = C();
    }
    return ans * fu;
  }
  long long Readll() {
    long long ans = 0LL, fu = 1LL;
    char ch = Readnum();
    if (ch == '-') fu = -1LL, ch = C();
    while (ch >= '0' && ch <= '9') {
      ans = ans * 10LL + ch - '0';
      ch = C();
    }
    return ans * fu;
  }
  inline void Readstring(string &x) {
    x.clear();
    char ch = C();
    while (!isdigit(ch) && !isalpha(ch) && ch != '#' && ch != '.') ch = C();
    while (isdigit(ch) || isalpha(ch) || ch == '#' || ch == '.') {
      x += ch;
      ch = C();
    }
  }
  inline void Readchstring(char s[]) {
    int len = 0;
    char ch = C();
    while (!isdigit(ch) && !isalpha(ch)) ch = C();
    while (isdigit(ch) || isalpha(ch)) {
      s[len++] = ch;
      ch = C();
    }
    s[len] = '\0';
  }
  inline void Specialread(char &c) {
    c = C();
    while (!isdigit(c) && !isalpha(c) && c != '#' && c != '.' && c != '=' &&
           c != 'B')
      c = C();
  }
} In;
inline void Read(int &x) { x = In(); }
inline void Read(int &x, int &y) {
  x = In();
  y = In();
}
inline void Read(int &x1, int &x2, int &x3) {
  x1 = In();
  x2 = In();
  x3 = In();
}
inline void Read(int &x1, int &x2, int &x3, int &x4) {
  x1 = In();
  x2 = In();
  x3 = In();
  x4 = In();
}
inline void Read(long long &x) { x = In.Readll(); }
inline void Read(long long &x, long long &y) {
  x = In.Readll();
  y = In.Readll();
}
inline void Read(long long &x1, long long &x2, long long &x3) {
  x1 = In.Readll();
  x2 = In.Readll();
  x3 = In.Readll();
}
inline void Read(long long &x1, long long &x2, long long &x3, long long &x4) {
  x1 = In.Readll();
  x2 = In.Readll();
  x3 = In.Readll();
  x4 = In.Readll();
}
template <typename T>
void Read(T a[], int st, int ed) {
  for (int(i) = (st); (i) <= (ed); ++(i)) Read(a[i]);
}
inline void FILEIO() {}
inline void FILEIO(string pname) {
  freopen((pname + ".in").c_str(), "r", stdin);
  freopen((pname + ".out").c_str(), "w", stdout);
}
inline void FILEIO_OICONTEST(string pname) {
  freopen((pname + ".in").c_str(), "r", stdin);
  freopen((pname + ".out").c_str(), "w", stdout);
}
void Printtime() {}
void END() {
  Printtime();
  exit(0);
}
template <typename T>
void END(T mes) {
  cout << mes << endl;
  END();
}
template <typename T>
void Print(T a[], int s, int t, char sp = ' ', char ed = '\n') {
  if (s > t) return;
  for (int i = s; i < t; i++) cout << a[i] << sp;
  cout << a[t] << ed;
  cout.flush();
}
template <typename T>
void Print(T a, int s = 0, int t = -1, char sp = ' ', char ed = '\n') {
  if (t == -1) t = a.size() - 1;
  for (int i = s; i <= t; i++) cout << a[i] << sp;
  cout << ed;
  cout.flush();
}
vector<int> Range(int l, int r) {
  vector<int> ret{};
  for (int(i) = (l); (i) <= (r); ++(i)) ret.push_back(i);
  return ret;
}
int n;
vector<int> e[131072];
int d[131072];
int depd[131072];
bool Dfs(int pos, int fa, int dep) {
  if (depd[dep] != -1 and depd[dep] != d[pos]) return 0;
  depd[dep] = d[pos];
  for (auto v : e[pos]) {
    if (v == fa) continue;
    if (!Dfs(v, pos, dep + 1)) return 0;
  }
  return 1;
}
inline bool Check(int root) {
  memset(depd, -1, sizeof(depd));
  return Dfs(root, 0, 0);
}
int dis[131072], from[131072];
queue<int> q;
pair<int, int> FindDia() {
  memset(dis, (0x3f3f3f3f), sizeof(dis));
  q.push(1);
  int s, t;
  dis[1] = 0;
  while (!q.empty()) {
    s = q.front();
    q.pop();
    for (auto v : e[s])
      if (dis[v] > dis[s] + 1) {
        dis[v] = dis[s] + 1;
        q.push(v);
      }
  }
  memset(dis, (0x3f3f3f3f), sizeof(dis));
  dis[s] = 0;
  q.push(s);
  while (!q.empty()) {
    t = q.front();
    q.pop();
    for (auto v : e[t])
      if (dis[v] > dis[t] + 1) {
        dis[v] = dis[t] + 1;
        from[v] = t;
        q.push(v);
      }
  }
  return {s, t};
}
int main() {
  FILEIO();
  Read(n);
  for (int(i) = 1; (i) <= (n - 1); ++(i)) {
    int a;
    Read(a);
    ;
    int b;
    Read(b);
    ;
    ;
    e[a].push_back(b);
    e[b].push_back(a);
    ++d[a];
    ++d[b];
  }
  if (n == 1) END(1);
  if (n == 2) END(2);
  pair<int, int> dia = FindDia();
  int s = dia.first, t = dia.second, disst = dis[t];
  int m = s;
  for (int u = t; u != s; u = from[u])
    if (dis[u] == dis[t] / 2) m = u;
  if (Check(s)) END(s);
  if (Check(t)) END(t);
  if (Check(m)) END(m);
  for (auto v : e[m]) {
    memset(dis, (0x3f3f3f3f), sizeof(dis));
    dis[m] = 0;
    q.push(m);
    while (!q.empty()) {
      int c = q.front();
      q.pop();
      for (auto v : e[c])
        if (dis[v] == (0x3f3f3f3f) and d[v] <= 2) {
          dis[v] = dis[c] + 1;
          q.push(v);
        }
    }
    m = -1;
    for (int(i) = 1; (i) <= (n); ++(i)) {
      if (d[i] == 1 and (m == -1 || dis[i] < dis[m])) m = i;
    }
    if (m != -1)
      if (Check(m)) END(m);
  }
  END(-1);
}
