#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
constexpr long long mod = 1000000007;
const long long INF = mod * mod;
const long double eps = 1e-12;
const long double pi = acosl(-1.0);
long long mod_pow(long long x, long long n, long long m = mod) {
  if (n < 0) {
    long long res = mod_pow(x, -n, m);
    return mod_pow(res, m - 2, m);
  }
  if (abs(x) >= m) x %= m;
  if (x < 0) x += m;
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % m;
    x = x * x % m;
    n >>= 1;
  }
  return res;
}
struct modint {
  long long n;
  modint() : n(0) { ; }
  modint(long long m) : n(m) {
    if (n >= mod)
      n %= mod;
    else if (n < 0)
      n = (n % mod + mod) % mod;
  }
  operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint& a, modint b) {
  a.n += b.n;
  if (a.n >= mod) a.n -= mod;
  return a;
}
modint operator-=(modint& a, modint b) {
  a.n -= b.n;
  if (a.n < 0) a.n += mod;
  return a;
}
modint operator*=(modint& a, modint b) {
  a.n = ((long long)a.n * b.n) % mod;
  return a;
}
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, long long n) {
  if (n == 0) return modint(1);
  modint res = (a * a) ^ (n / 2);
  if (n % 2) res = res * a;
  return res;
}
long long inv(long long a, long long p) {
  return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }
modint operator/=(modint& a, modint b) {
  a = a / b;
  return a;
}
const int max_n = 1 << 2;
modint fact[max_n], factinv[max_n];
void init_f() {
  fact[0] = modint(1);
  for (int i = 0; i < max_n - 1; i++) {
    fact[i + 1] = fact[i] * modint(i + 1);
  }
  factinv[max_n - 1] = modint(1) / fact[max_n - 1];
  for (int i = max_n - 2; i >= 0; i--) {
    factinv[i] = factinv[i + 1] * modint(i + 1);
  }
}
modint comb(int a, int b) {
  if (a < 0 || b < 0 || a < b) return 0;
  return fact[a] * factinv[b] * factinv[a - b];
}
modint combP(int a, int b) {
  if (a < 0 || b < 0 || a < b) return 0;
  return fact[a] * factinv[a - b];
}
int sz = (1 << 18);
set<pair<int, int> > node[1 << 19];
void add(int i, int j, int id) {
  int k = (i + sz - 1);
  node[k].insert({j, id});
  while (k > 0) {
    k = (k - 1) / 2;
    node[k].insert({j, id});
  }
}
void del(int i, int j, int id) {
  int k = (i + sz - 1);
  node[k].erase({j, id});
  while (k > 0) {
    k = (k - 1) / 2;
    node[k].erase({j, id});
  }
}
struct ste {
  int k, l, r;
};
vector<int> all_search(int lx, int ly) {
  vector<int> res;
  vector<ste> vs;
  vs.push_back({0, 0, sz});
  int a = lx, b = sz;
  while (!vs.empty()) {
    ste s = vs.back();
    vs.pop_back();
    if (s.r <= a || b <= s.l) continue;
    if (a <= s.l && s.r <= b) {
      pair<int, int> p = {ly, -1};
      node[s.k].insert(p);
      auto itr = node[s.k].find(p);
      itr++;
      node[s.k].erase(p);
      while (itr != node[s.k].end()) {
        res.push_back((*itr).second);
        itr++;
      }
    } else {
      vs.push_back({2 * s.k + 1, s.l, (s.l + s.r) / 2});
      vs.push_back({2 * s.k + 2, (s.l + s.r) / 2, s.r});
    }
  }
  return res;
}
void solve() {
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n), d(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i] >> d[i];
  vector<int> vx, vy;
  for (int i = 0; i < n; i++) {
    vx.push_back(a[i]);
    vx.push_back(c[i]);
    vy.push_back(b[i]);
    vy.push_back(d[i]);
  }
  vx.push_back(0);
  vy.push_back(0);
  sort((vx).begin(), (vx).end());
  vx.erase(unique((vx).begin(), (vx).end()), vx.end());
  sort((vy).begin(), (vy).end());
  vy.erase(unique((vy).begin(), (vy).end()), vy.end());
  for (int i = 0; i < n; i++) {
    a[i] = lower_bound((vx).begin(), (vx).end(), a[i]) - vx.begin();
    b[i] = lower_bound((vy).begin(), (vy).end(), b[i]) - vy.begin();
    c[i] = lower_bound((vx).begin(), (vx).end(), c[i]) - vx.begin();
    d[i] = lower_bound((vy).begin(), (vy).end(), d[i]) - vy.begin();
    add(c[i], d[i], i);
  }
  vector<int> nex(n);
  nex[n - 1] = -1;
  vector<int> dist(n, mod);
  dist[n - 1] = 0;
  queue<int> q;
  q.push(n - 1);
  del(c[n - 1], d[n - 1], n - 1);
  while (!q.empty()) {
    int id = q.front();
    q.pop();
    vector<int> nexs = all_search(a[id], b[id]);
    for (int to : nexs) {
      dist[to] = dist[id] + 1;
      nex[to] = id;
      del(c[to], d[to], to);
      q.push(to);
    }
  }
  int mi = mod;
  int chk = -1;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0 && b[i] == 0) {
      if (dist[i] < mi) {
        mi = dist[i];
        chk = i;
      }
    }
  }
  if (chk < 0) {
    cout << -1 << "\n";
  } else {
    cout << mi + 1 << "\n";
    vector<int> ans;
    while (chk != n - 1) {
      ans.push_back(chk);
      chk = nex[chk];
    }
    ans.push_back(chk);
    for (int i = 0; i < ans.size(); i++) {
      if (i > 0) cout << " ";
      cout << ans[i] + 1;
    }
    cout << "\n";
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  solve();
  return 0;
}
