#include <bits/stdc++.h>
using namespace std;
const int N = 200100, INF = 0x3f3f3f3f;
multiset<pair<int, int> > st[N << 2];
multiset<pair<int, int> >::iterator it, it2;
queue<int> q;
int u, dis[N], pre[N];
int a[N], b[N], c[N], d[N], f[N];
void updata(int rt, int l, int r, int x, int y, int id) {
  st[rt].insert(pair<int, int>(y, id));
  if (l == r) return;
  int m = l + r >> 1;
  if (x <= m)
    updata(rt << 1, l, m, x, y, id);
  else
    updata(rt << 1 | 1, m + 1, r, x, y, id);
}
void query(int rt, int l, int r, int tl, int tr, int y) {
  if (l == r) {
    it = st[rt].lower_bound(pair<int, int>(y, INF));
    for (it2 = st[rt].begin(); it2 != it; it2++) {
      int now = (*it2).second;
      q.push(now);
      dis[now] = dis[u] + 1;
      pre[now] = u;
    }
    st[rt].erase(st[rt].begin(), it);
    return;
  }
  if (tl <= l && r <= tr) {
    it = st[rt].lower_bound(pair<int, int>(y, INF));
    if (it == st[rt].begin()) return;
    st[rt].erase(st[rt].begin(), it);
  }
  int m = l + r >> 1;
  if (tr <= m)
    query(rt << 1, l, m, tl, tr, y);
  else if (m < tl)
    query(rt << 1 | 1, m + 1, r, tl, tr, y);
  else
    query(rt << 1, l, m, tl, m, y), query(rt << 1 | 1, m + 1, r, m + 1, tr, y);
}
int main() {
  int n, nn = 0;
  cin >> n;
  memset(dis, 0x3f, sizeof dis);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d%d", &a[i], &b[i], &c[i], &d[i]);
    f[++nn] = a[i];
    f[++nn] = c[i];
    if (a[i] == 0 && b[i] == 0) {
      q.push(i);
      dis[i] = 1;
      pre[i] = 0;
    }
  }
  sort(f + 1, f + 1 + nn);
  nn = unique(f + 1, f + 1 + nn) - f - 1;
  for (int i = 1; i <= n; i++) {
    a[i] = lower_bound(f + 1, f + 1 + nn, a[i]) - f;
    c[i] = lower_bound(f + 1, f + 1 + nn, c[i]) - f;
    if (dis[i] != 1) {
      updata(1, 1, nn, a[i], b[i], i);
    }
  }
  while (!q.empty()) {
    u = q.front();
    q.pop();
    query(1, 1, nn, 1, c[u], d[u]);
  }
  if (dis[n] != INF) {
    cout << dis[n] << endl;
    int now = n;
    vector<int> r;
    while (now) {
      r.push_back(now);
      now = pre[now];
    }
    for (int i = r.size() - 1; i >= 0; i--) {
      if (i != r.size() - 1) printf(" ");
      printf("%d", r[i]);
    }
    cout << endl;
  } else
    cout << -1 << endl;
}
