#include <bits/stdc++.h>
using namespace std;
int n, l, r, bo[100005], lr[100005][3], m, c[100005], cnt;
multiset<pair<int, int>> s[400000];
struct arr1 {
  int num, x, y, p, q;
} a[100005];
struct arr2 {
  int x, num, bo;
} b[200005];
bool cmp1(arr2 x, arr2 y) { return x.x < y.x; }
bool cmp2(arr1 x, arr1 y) {
  return ((x.x < y.x) || ((x.x == y.x) && (x.y < y.y)));
}
void writeln(int x) {
  if (x == 1) return;
  writeln(lr[x][1]);
  printf("%d ", a[lr[x][2]].num);
}
void build(int l, int r, int k) {
  for (int i = l; i <= r; i++) s[k].insert(make_pair(a[i].y, i));
  if (l == r) return;
  int mid = (l + r) >> 1;
  build(l, mid, k * 2);
  build(mid + 1, r, k * 2 + 1);
}
void find(int l, int r, int k, int y) {
  if (a[r].x <= a[y].p) {
    do {
      multiset<pair<int, int>>::iterator it = s[k].begin();
      if (bo[it->second]) {
        s[k].erase(it);
        continue;
      }
      if ((it == s[k].end()) || ((it->first) > a[y].q)) break;
      ++m;
      c[m] = it->second;
      bo[it->second] = 1;
      s[k].erase(it);
    } while (1 == 1);
    return;
  }
  if (l == r) return;
  int mid = (l + r) >> 1;
  find(l, mid, k * 2, y);
  if (a[mid + 1].x <= a[y].p) find(mid + 1, r, k * 2 + 1, y);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    a[i].num = i;
    scanf("%d%d%d%d", &a[i].x, &a[i].y, &a[i].p, &a[i].q);
    b[i * 2 - 1] = {a[i].x, i, 0};
    b[i * 2] = {a[i].p, i, 1};
  }
  sort(b + 1, b + n + n + 1, cmp1);
  for (int i = 1; i <= 2 * n; i++) {
    if (b[i].bo)
      a[b[i].num].p = cnt;
    else
      a[b[i].num].x = cnt;
    if (b[i].x != b[i + 1].x) ++cnt;
  }
  sort(a + 1, a + n + 1, cmp2);
  build(1, n, 1);
  l = r = 1;
  for (int i = 2; i <= n; i++) lr[i][0] = 10000000;
  a[0].q = a[0].p = 0;
  int bo;
  do {
    bo = 1;
    m = 0;
    find(1, n, 1, lr[l][2]);
    for (int i = 1; i <= m; i++) {
      ++r;
      lr[r][0] = lr[l][0] + 1;
      lr[r][1] = l;
      lr[r][2] = c[i];
      if (a[c[i]].num == n) {
        bo = 0;
        break;
      }
    }
    ++l;
  } while (l <= r && bo);
  if (a[lr[r][2]].num != n)
    puts("-1");
  else {
    printf("%d\n", lr[r][0]);
    writeln(r);
  }
}
