#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline string get() {
  char ch[1000];
  scanf("%s", ch);
  return ch;
}
const int MAX_N = 1e5 + 10;
const int MAX_LG = 21;
bool mark[MAX_N];
long long di[MAX_N];
pair<long long, long long> po[MAX_N];
long long a[MAX_N], b[MAX_N], c[MAX_N], d[MAX_N];
pair<long long, long long> st[MAX_LG][4 * MAX_N];
long long cur[MAX_LG][4 * MAX_N];
long long pr[MAX_N];
queue<long long> q;
inline void build(long long p, long long l, long long r, long long dep = 0) {
  if (l == r) {
    st[dep][l] = {b[po[l].second], po[l].second};
    return;
  } else {
    long long mid = (l + r) >> 1;
    build(2 * p + 1, l, mid, dep + 1);
    build(2 * p + 2, mid + 1, r, dep + 1);
    merge(st[dep + 1] + l, st[dep + 1] + mid + 1, st[dep + 1] + mid + 1,
          st[dep + 1] + r + 1, st[dep] + l);
  }
}
inline void query(long long p, long long l, long long r, long long x,
                  long long y, long long id, long long dep = 0) {
  if (l > y || r < x) return;
  if (l >= x && r <= y) {
    cur[dep][p] = max(cur[dep][p], l);
    while (cur[dep][p] <= r && d[id] >= st[dep][cur[dep][p]].first) {
      long long newId = st[dep][cur[dep][p]].second;
      cur[dep][p]++;
      if (mark[newId]) continue;
      di[newId] = di[id] + 1;
      mark[newId] = true;
      pr[newId] = id;
      q.push(newId);
    }
    return;
  }
  long long mid = (l + r) >> 1;
  query(2 * p + 1, l, mid, x, y, id, dep + 1);
  query(2 * p + 2, mid + 1, r, x, y, id, dep + 1);
  return;
}
inline void printSol(long long n) {
  if (n == -1) return;
  printSol(pr[n]);
  cout << n + 1 << " ";
}
int32_t main() {
  memset(pr, -1, sizeof(pr));
  long long n = in();
  for (long long i = 0; i < n; i++) {
    a[i] = in(), b[i] = in(), c[i] = in(), d[i] = in();
    po[i] = {a[i], i};
  }
  sort(po, po + n);
  build(0, 0, n - 1);
  memset(di, -1, sizeof(di));
  for (long long i = 0; i < n; ++i) {
    if (a[i] == 0 && b[i] == 0) q.push(i), di[i] = 1, mark[i] = true;
  }
  while (q.size()) {
    long long id = q.front();
    q.pop();
    long long lim =
        upper_bound(po, po + n, make_pair(c[id], (long long)1e9)) - po;
    if (lim == 0) continue;
    lim--;
    query(0, 0, n - 1, 0, lim, id);
  }
  cout << di[n - 1] << "\n";
  if (di[n - 1] != -1) {
    printSol(n - 1);
    cout << "\n";
  }
}
