#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const int N = 1e6 + 5;
int read() {
  int first;
  scanf("%d", &first);
  return first;
}
int tot;
int b[N];
int pre[N];
queue<tuple<int, int, int> > q;
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    s[N];
struct node {
  int a, b, c, d, id;
} a[N];
struct seg_tree {
  pair<int, int> t[N << 2];
  void build(int i, int l, int r) {
    if (l == r) {
      t[i].first = s[l].empty() ? inf : s[l].top().first;
      t[i].second = l;
      return;
    }
    int mid = l + r >> 1;
    build(i << 1, l, mid);
    build(i << 1 | 1, mid + 1, r);
    t[i] = min(t[i << 1], t[i << 1 | 1]);
  }
  void update(int i, int l, int r, int first) {
    if (l == r) {
      t[i].first = s[l].empty() ? inf : s[l].top().first;
      return;
    }
    int mid = l + r >> 1;
    if (mid >= first) {
      update(i << 1, l, mid, first);
    } else {
      update(i << 1 | 1, mid + 1, r, first);
    }
    t[i] = min(t[i << 1], t[i << 1 | 1]);
  }
  pair<int, int> find(int i, int l, int r, int ql, int qr) {
    if (ql <= l && r <= qr) {
      return t[i];
    }
    int mid = l + r >> 1;
    if (mid >= qr)
      return find(i << 1, l, mid, ql, qr);
    else if (mid < ql)
      return find(i << 1 | 1, mid + 1, r, ql, qr);
    else
      return min(find(i << 1, l, mid, ql, qr),
                 find(i << 1 | 1, mid + 1, r, ql, qr));
  }
} seg;
int Id(int first) { return lower_bound(b + 1, b + 1 + *b, first) - b; }
void dfs(int first) {
  ++tot;
  if (~pre[first])
    dfs(pre[first]);
  else {
    printf("%d\n", tot);
  }
  printf("%d ", first);
}
int main() {
  int n = read();
  for (int i = 1; i <= n; i++) {
    b[++*b] = a[i].a = read();
    b[++*b] = a[i].b = read();
    b[++*b] = a[i].c = read();
    b[++*b] = a[i].d = read();
    a[i].id = i;
  }
  b[++*b] = 0;
  sort(b + 1, b + 1 + *b);
  *b = unique(b + 1, b + 1 + *b) - b - 1;
  for (int i = 1; i <= n; i++) {
    a[i].a = Id(a[i].a);
    a[i].b = Id(a[i].b);
    a[i].c = Id(a[i].c);
    a[i].d = Id(a[i].d);
    s[a[i].b].push(pair<int, int>(a[i].a, a[i].id));
  }
  seg.build(1, 1, *b);
  q.push(tuple<int, int, int>(Id(0), Id(0), -1));
  tuple<int, int, int> u;
  int first, second, id;
  while (!q.empty()) {
    u = q.front(), q.pop();
    tie(first, second, id) = u;
    while (1) {
      pair<int, int> res = seg.find(1, 1, *b, 1, second);
      if (res.first > first) break;
      while (s[res.second].size() && s[res.second].top().first <= first) {
        int id2 = s[res.second].top().second;
        s[res.second].pop();
        pre[id2] = id;
        q.push(tuple<int, int, int>(a[id2].c, a[id2].d, id2));
      }
      seg.update(1, 1, *b, res.second);
    }
  }
  if (!pre[n]) {
    puts("-1");
  } else {
    dfs(n);
  }
}
