#include <bits/stdc++.h>
using namespace std;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
long long ln, lk, lm;
int a[100005], b[100005], c[100005], d[100005];
map<int, int> id;
vector<int> vp[100005 * 2];
int cmp(int x, int y) {
  if (b[x] == b[y]) return x < y;
  return b[x] > b[y];
}
int ans[100005];
int M;
int T[1 << 20];
int getMin(int x, int y) { return b[x] < b[y] ? x : y; }
void update(int l, int id) {
  l += M;
  T[l] = id;
  while (l > 1) {
    T[l >> 1] = getMin(T[l], T[l ^ 1]);
    l >>= 1;
  }
}
int qy(int l, int r) {
  int ans = 0;
  for (l = l + M - 1, r = r + M + 1; l ^ r ^ 1; l >>= 1, r >>= 1) {
    if (~l & 1) ans = getMin(ans, T[l ^ 1]);
    if (r & 1) ans = getMin(ans, T[r ^ 1]);
  }
  return ans;
}
void fmain() {
  scanf("%d", &n);
  for (int(i) = 1; (i) <= (int)(n); (i)++)
    scanf("%d%d%d%d", a + i, b + i, c + i, d + i);
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    id[a[i]];
    id[c[i]];
  }
  int cnt = 1;
  for (auto &p : id) p.second = cnt++;
  id[0];
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    a[i] = id[a[i]];
    c[i] = id[c[i]];
  }
  for (int(i) = 1; (i) <= (int)(n); (i)++) vp[a[i]].push_back(i);
  for (int(i) = 1; (i) <= (int)(cnt); (i)++)
    sort(vp[i].begin(), vp[i].end(), cmp);
  for (M = 1; cnt + 2 > M; M <<= 1)
    ;
  b[0] = (1 << 30);
  for (int(i) = 1; (i) <= (int)(cnt); (i)++)
    if (!vp[i].empty()) {
      update(i, vp[i].back());
      vp[i].pop_back();
    }
  queue<pair<pair<int, int>, int>> q;
  q.push({{1, 0}, 0});
  memset(ans, -1, sizeof ans);
  while (!q.empty()) {
    int ta = q.front().first.first, tb = q.front().first.second;
    int preId = q.front().second;
    q.pop();
    while (1) {
      int tmp = qy(1, ta);
      if (tmp == 0) break;
      if (b[tmp] > tb) break;
      ans[tmp] = preId;
      int nxt = 0;
      if (!vp[a[tmp]].empty()) {
        nxt = vp[a[tmp]].back();
        vp[a[tmp]].pop_back();
      }
      update(a[tmp], nxt);
      q.push({{c[tmp], d[tmp]}, tmp});
    }
  }
  if (ans[n] == -1)
    puts("-1");
  else {
    vector<int> vv;
    for (int i = n; i > 0; i = ans[i]) {
      vv.push_back(i);
    }
    printf("%d\n", vv.size());
    for (int j = vv.size() - 1; j >= 0; j--) printf("%d ", vv[j]);
  }
}
int main() {
  fmain();
  return 0;
}
