#include <bits/stdc++.h>
using namespace std;
int Q[100005];
struct Point {
  int a, b, c, d, id;
  bool operator<(const Point &p) const { return a != p.a ? a < p.a : b < p.b; }
} p[100005];
bool vis[100005];
int pa[100005], dis[100005];
bool cmp(Point a, Point b) { return a.b != b.b ? a.b < b.b : a.a < b.a; }
int sto[100005];
int from[100005], xmin[100005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    p[i].id = i;
    scanf("%d %d %d %d", &p[i].a, &p[i].b, &p[i].c, &p[i].d);
  }
  sort(p + 1, p + n + 1);
  for (int i = 1; i <= n; i += 316) {
    int j = min(n, i + 316 - 1);
    xmin[i] = p[i].a, from[i] = i;
    sort(p + i, p + j + 1, cmp);
  }
  int h = 1, t = 0;
  vis[0] = 1, Q[++t] = 0;
  while (h <= t) {
    int cur = Q[h++];
    if (p[cur].id == n) {
      printf("%d\n", dis[cur]);
      int cnt = 0;
      while (cur) {
        sto[++cnt] = cur;
        cur = pa[cur];
      }
      for (int i = cnt; i; i--) printf("%d ", p[sto[i]].id);
      return 0;
    }
    int x = p[cur].c, y = p[cur].d;
    for (int i = 1, j; i <= n; i += 316) {
      if (xmin[i] > x) break;
      bool bf = 0;
      for (j = from[i]; j <= n && j <= i + 316 - 1; j++) {
        if (p[j].b > y) break;
        if (vis[j]) continue;
        if (p[j].a <= x) {
          vis[j] = 1;
          dis[j] = dis[cur] + 1;
          pa[j] = cur;
          Q[++t] = j;
        } else
          bf = 1;
      }
      if (!bf) from[i] = j;
    }
  }
  puts("-1");
}
