#include <bits/stdc++.h>
using namespace std;
struct Card {
  int a, b, c, d;
};
struct BackEdge {
  int card;
  pair<int, int> pos;
  BackEdge(int card = 0, pair<int, int> pos = {0, 0}) : card(card), pos(pos) {}
};
int n;
Card c[100005];
set<int> xCoord;
unordered_map<int, int> xNorm;
pair<int, int> sol;
bool done = 0;
vector<int> vCard[2 * 100005];
vector<int> ai[8 * 100005];
map<pair<int, int>, BackEdge> bk;
queue<pair<int, int> > q;
bool Comp(int a, int b) { return c[a].b > c[b].b; }
void merge(vector<int> &v1, vector<int> &v2, vector<int> &v) {
  assert(v.empty());
  int n1 = int(v1.size());
  int n2 = int(v2.size());
  int i = 0, j = 0;
  while (i < n1 || j < n2) {
    if (i == n1 || (j < n2 && Comp(v1[i], v2[j]) == 0))
      v.push_back(v2[j++]);
    else
      v.push_back(v1[i++]);
  }
}
void build_ai(int node, int l, int r) {
  if (l == r) {
    for (auto x : vCard[l]) ai[node].push_back(x);
    return;
  }
  int mid = (l + r) >> 1;
  build_ai(2 * node, l, mid);
  build_ai(2 * node + 1, mid + 1, r);
  merge(ai[2 * node], ai[2 * node + 1], ai[node]);
}
void op_ai(int node, int l, int r, int rq, int mxy) {
  if (r <= rq) {
    while (!ai[node].empty()) {
      Card x = c[ai[node].back()];
      if (bk.count(make_pair(x.c, x.d))) {
        ai[node].pop_back();
        continue;
      }
      if (x.b <= mxy) {
        bk[make_pair(x.c, x.d)] = BackEdge(ai[node].back(), make_pair(rq, mxy));
        q.push(make_pair(x.c, x.d));
        if (x.c >= c[n].a && x.d >= c[n].b) {
          done = 1;
          sol = make_pair(x.c, x.d);
        }
        ai[node].pop_back();
        continue;
      }
      break;
    }
    return;
  }
  int mid = (l + r) >> 1;
  op_ai(2 * node, l, mid, rq, mxy);
  if (mid + 1 <= rq) op_ai(2 * node + 1, mid + 1, r, rq, mxy);
}
void print(pair<int, int> x) {
  static int cnt = 1;
  BackEdge b = bk[x];
  if (b.card == 0) {
    printf("%d\n", cnt);
    return;
  }
  ++cnt;
  print(b.pos);
  printf("%d ", b.card);
}
int main() {
  scanf("%d", &n);
  xCoord.insert(0);
  for (int i = 1; i <= n; ++i) {
    scanf("%d %d %d %d", &c[i].a, &c[i].b, &c[i].c, &c[i].d);
    xCoord.insert(c[i].a);
    xCoord.insert(c[i].c);
  }
  int mxX = 0;
  for (auto x : xCoord) xNorm[x] = (++mxX);
  for (int i = 1; i <= n; ++i) {
    c[i].a = xNorm[c[i].a], c[i].c = xNorm[c[i].c];
    vCard[c[i].a].push_back(i);
  }
  for (int i = 1; i <= mxX; ++i) sort(vCard[i].begin(), vCard[i].end(), Comp);
  build_ai(1, 1, mxX);
  if (c[n].a <= xNorm[0] && c[n].b <= 0) {
    printf("1\n%d\n", n);
    return 0;
  }
  bk[make_pair(xNorm[0], 0)] = BackEdge();
  q.push(make_pair(xNorm[0], 0));
  while (!q.empty() && !done) {
    pair<int, int> x = q.front();
    q.pop();
    op_ai(1, 1, mxX, x.first, x.second);
  }
  if (!done)
    printf("-1\n");
  else {
    print(sol);
    printf("%d\n", n);
  }
  return 0;
}
