#include <bits/stdc++.h>
using namespace std;
template <typename T>
void get_int(T &x) {
  char t = getchar();
  bool neg = false;
  x = 0;
  for (; (t > '9' || t < '0') && t != '-'; t = getchar())
    ;
  if (t == '-') neg = true, t = getchar();
  for (; t <= '9' && t >= '0'; t = getchar()) x = x * 10 + t - '0';
  if (neg) x = -x;
}
template <typename T>
void print_int(T x) {
  if (x < 0) putchar('-'), x = -x;
  short a[20] = {}, sz = 0;
  while (x > 0) a[sz++] = x % 10, x /= 10;
  if (sz == 0) putchar('0');
  for (int i = sz - 1; i >= 0; i--) putchar('0' + a[i]);
}
const int inf = 0x3f3f3f3f;
const long long Linf = 1ll << 61;
const double pi = acos(-1.0);
const int maxn = 200111;
int n, f[maxn], pre[maxn];
int a[maxn], b[maxn], c[maxn], d[maxn];
int q[maxn], qf, qr;
set<pair<int, int> > st[maxn];
bool ok[maxn];
void addp(int x, int y, int v) {
  for (; x < maxn; x += x & -x) st[x].insert(make_pair(y, v));
}
void delp(int x, int y, int v) {
  for (; x < maxn; x += x & -x) st[x].erase(make_pair(y, v));
}
int allp[maxn], cnt;
void findall(int x, int y) {
  cnt = 0;
  set<pair<int, int> >::iterator it;
  for (; x > 0; x -= x & -x) {
    for (it = st[x].begin(); it != st[x].end(); it++) {
      if (it->first > y) break;
      allp[cnt++] = it->second;
    }
  }
}
int bfs(int s) {
  qf = qr = 0;
  memset(f, -1, sizeof(f));
  f[s] = 1;
  q[qr++] = s;
  while (qf != qr) {
    int x = q[qf++];
    if (ok[x]) return x;
    findall(a[x], b[x]);
    for (int _ = 0, i; _ < cnt; _++) {
      i = allp[_];
      delp(c[i], d[i], i);
      q[qr++] = i;
      f[i] = f[x] + 1;
      pre[i] = x;
    }
  }
  return -1;
}
vector<int> ans;
int main() {
  get_int(n);
  vector<int> vx, vy;
  for (int i = 1; i <= n; i++) {
    get_int(a[i]), get_int(b[i]);
    vx.push_back(a[i]);
    vy.push_back(b[i]);
    get_int(c[i]), get_int(d[i]);
    vx.push_back(c[i]);
    vy.push_back(d[i]);
  }
  sort(vx.begin(), vx.end());
  vx.erase(unique(vx.begin(), vx.end()), vx.end());
  sort(vy.begin(), vy.end());
  vy.erase(unique(vy.begin(), vy.end()), vy.end());
  for (int i = 1; i <= n; i++) {
    ok[i] = (a[i] == 0 && b[i] == 0);
    a[i] = vx.end() - lower_bound(vx.begin(), vx.end(), a[i]);
    b[i] = vy.end() - lower_bound(vy.begin(), vy.end(), b[i]);
    c[i] = vx.end() - lower_bound(vx.begin(), vx.end(), c[i]);
    d[i] = vy.end() - lower_bound(vy.begin(), vy.end(), d[i]);
    if (i < n) addp(c[i], d[i], i);
  }
  int t = bfs(n);
  if (t == -1) {
    puts("-1");
    return 0;
  }
  printf("%d\n", f[t]);
  while (t) {
    printf("%d ", t);
    t = pre[t];
  }
  return 0;
}
