#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0);
const int MAXN = 200003;
const int INF = 1000 * 1001 * 1101;
int a[MAXN], b[MAXN];
int c[MAXN], d[MAXN];
int id[MAXN];
int f[MAXN];
int p[MAXN];
int pid[MAXN];
int rmq[4 * MAXN];
int bst(int v1, int v2) {
  if (b[v1] <= b[v2])
    return v1;
  else
    return v2;
}
void upd(int v) { rmq[v] = bst(rmq[v * 2 + 1], rmq[v * 2 + 2]); }
void create_rmq(int v, int l, int r) {
  if (l == r)
    rmq[v] = id[l];
  else {
    create_rmq(v * 2 + 1, l, (l + r) / 2);
    create_rmq(v * 2 + 2, (l + r) / 2 + 1, r);
    upd(v);
  }
}
int lv;
void modify_rmq(int v, int l, int r) {
  if (l != r) {
    int md = (l + r) / 2;
    if (lv <= md)
      modify_rmq(v * 2 + 1, l, md);
    else
      modify_rmq(v * 2 + 2, md + 1, r);
    upd(v);
  }
}
int get_rmq(int v, int l, int r) {
  if (l > lv) return 0;
  if (r <= lv) return rmq[v];
  return bst(get_rmq(v * 2 + 1, l, (l + r) / 2),
             get_rmq(v * 2 + 2, (l + r) / 2 + 1, r));
}
int q[MAXN], qe = 0;
bool cmp(int i1, int i2) { return (a[i1] < a[i2]); }
int main() {
  ios_base::sync_with_stdio(0);
  c[0] = d[0] = 0;
  b[0] = INF;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    id[i - 1] = i;
    f[i] = n + 1;
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  sort(id, id + n, cmp);
  for (int i = 0; i < n; i++) pid[id[i]] = i;
  create_rmq(0, 0, n - 1);
  q[qe++] = 0;
  int ans = -1;
  for (int i = 0; i < qe; i++) {
    int v = q[i];
    int lg = 0, rg = n;
    while (lg < rg) {
      int md = (lg + rg) / 2;
      if (a[id[md]] <= c[v])
        lg = md + 1;
      else
        rg = md;
    }
    while (true) {
      lv = lg - 1;
      int u = get_rmq(0, 0, n - 1);
      if (b[u] > d[v]) break;
      f[u] = f[v] + 1;
      p[u] = v;
      q[qe++] = u;
      b[u] = INF;
      lv = pid[u];
      modify_rmq(0, 0, n - 1);
    }
  }
  if (f[n] > n) {
    cout << -1 << endl;
  } else {
    qe = 0;
    int cur = n;
    while (cur != 0) {
      q[qe++] = cur;
      cur = p[cur];
    }
    cout << qe << endl;
    for (int i = qe - 1; i >= 0; i--) cout << q[i] << " ";
    cout << endl;
  }
  return 0;
}
