#include <bits/stdc++.h>
using namespace std;
struct _ {
  int a, b, c, d, id;
  bool operator<(const _ &ob) const { return b < ob.b; }
} a[200010];
struct __ {
  int val, id;
  bool operator<(const __ &ob) const { return val < ob.val; }
};
struct event {
  int x, y, depth, id;
};
queue<event> q;
set<int> ss;
multiset<__> s[200010];
_ min_[800010];
int val[200010], tx, ty, n, anss[200010], ans;
int fa[200010];
void pushup(int rt) { min_[rt] = min(min_[rt << 1], min_[rt << 1 | 1]); }
void update(_ tar, int l, int r, int rt) {
  if (l == r) {
    min_[rt] = tar;
    return;
  }
  int m = l + r >> 1;
  if (tar.a <= m)
    update(tar, l, m, rt << 1);
  else
    update(tar, m + 1, r, rt << 1 | 1);
  pushup(rt);
}
_ query(int L, int R, int l, int r, int rt) {
  if (L <= l && r <= R) return min_[rt];
  int m = l + r >> 1;
  _ ans;
  ans.b = 1234567890;
  if (m >= L) ans = min(ans, query(L, R, l, m, rt << 1));
  if (m < R) ans = min(ans, query(L, R, m + 1, r, rt << 1 | 1));
  return ans;
}
void bfs(int x, int y, int depth, int id) {
  if (id == n) {
    ans = depth;
    anss[depth] = id;
    return;
  }
  _ t = query(1, x, 1, n << 1, 1);
  while (t.b <= y) {
    s[t.a].erase(s[t.a].begin());
    if (s[t.a].empty())
      update((_){t.a, 1234567890, 0, 0, 0}, 1, n << 1, 1);
    else
      update(a[s[t.a].begin()->id - 1], 1, n << 1, 1);
    q.push((event){t.c, t.d, depth + 1, t.id});
    fa[t.id] = id;
    t = query(1, x, 1, n << 1, 1);
  }
}
void bbfs(int x, int y, int depth, int id) {
  q.push((event){x, y, depth, id});
  event t;
  while (!q.empty()) {
    t = q.front();
    q.pop();
    bfs(t.x, t.y, t.depth, t.id);
    if (ans) return;
  }
}
int main() {
  memset(min_, 63, sizeof(min_));
  memset(val, 63, sizeof(val));
  scanf("%d", &n);
  int i;
  for (i = 0; i < n; i++) {
    scanf("%d%d%d%d", &a[i].a, &a[i].b, &a[i].c, &a[i].d);
    ss.insert(a[i].a);
    ss.insert(a[i].c);
  }
  set<int>::iterator it;
  for (it = ss.begin(), i = 1; it != ss.end(); it++, i++) {
    val[i] = *it;
  }
  for (i = 0; i < n; i++) {
    a[i].a = lower_bound(val + 1, val + 1 + (n << 1), a[i].a) - val;
    a[i].c = lower_bound(val + 1, val + 1 + (n << 1), a[i].c) - val;
    a[i].id = i + 1;
  }
  tx = a[n - 1].c;
  ty = a[n - 1].d;
  if (*ss.begin()) {
    printf("-1\n");
    return 0;
  }
  int t;
  for (i = 0; i < n; i++) {
    t = query(a[i].a, a[i].a, 1, n << 1, 1).b;
    if (a[i].b < t) update(a[i], 1, n << 1, 1);
    s[a[i].a].insert((__){a[i].b, i + 1});
  }
  bbfs(1, 0, 0, -1);
  if (!ans)
    printf("-1\n");
  else {
    for (i = ans; i; i--) {
      anss[i - 1] = fa[anss[i]];
    }
    printf("%d\n", ans);
    for (i = 1; i <= ans; i++) {
      printf("%d ", anss[i]);
    }
    printf("\n");
  }
  return 0;
}
