#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 7;
int n;
int a[N], b[N], c[N], d[N];
vector<int> upd;
set<pair<int, int> > seg[N * 4];
int dis[N];
void add(int p, bool tp, int v = 1, int s = 0, int e = N) {
  if (tp)
    seg[v].insert({b[p], p});
  else
    seg[v].erase({b[p], p});
  if (e - s == 1) return;
  if (a[p] < ((s + e) / 2))
    add(p, tp, v * 2, s, ((s + e) / 2));
  else
    add(p, tp, v * 2 + 1, ((s + e) / 2), e);
}
void get(int l, int r, int val, int v = 1, int s = 0, int e = N) {
  if (r <= s || e <= l) return;
  if (l <= s && e <= r) {
    for (auto p : seg[v]) {
      if (p.first <= val)
        upd.push_back(p.second);
      else
        break;
    }
    return;
  }
  get(l, r, val, v * 2, s, ((s + e) / 2));
  get(l, r, val, v * 2 + 1, ((s + e) / 2), e);
}
int par[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  vector<int> vc;
  vc.push_back(0);
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    vc.push_back(a[i]);
    vc.push_back(b[i]);
    vc.push_back(c[i]);
    vc.push_back(d[i]);
  }
  sort(vc.begin(), vc.end());
  vc.resize(unique(vc.begin(), vc.end()) - vc.begin());
  for (int i = 1; i <= n; i++) {
    a[i] = lower_bound(vc.begin(), vc.end(), a[i]) - vc.begin();
    b[i] = lower_bound(vc.begin(), vc.end(), b[i]) - vc.begin();
    c[i] = lower_bound(vc.begin(), vc.end(), c[i]) - vc.begin();
    d[i] = lower_bound(vc.begin(), vc.end(), d[i]) - vc.begin();
    add(i, 1);
  }
  queue<int> q;
  q.push(0);
  while (q.size()) {
    int v = q.front();
    q.pop();
    upd.clear();
    get(0, c[v] + 1, d[v]);
    for (auto u : upd) {
      par[u] = v;
      dis[u] = dis[v] + 1;
      q.push(u);
      add(u, 0);
    }
  }
  if (dis[n] == 0)
    cout << -1;
  else {
    cout << dis[n] << '\n';
    deque<int> dq;
    while (n != 0) {
      dq.push_front(n);
      n = par[n];
    }
    for (auto x : dq) cout << x << ' ';
  }
  return 0;
}
