#include <bits/stdc++.h>
using namespace std;
struct spell {
  int c, d;
  spell(int C, int D) {
    c = C;
    d = D;
  }
  spell() { c = d = -1; }
};
spell all[100005];
int sz;
struct node {
  int u, d, l, r;
  node *ch[4];
  int ind;
  node(int U, int D, int L, int R) {
    for (int i = 0; i < 4; i++) {
      ch[i] = NULL;
    }
    u = U;
    d = D;
    l = L;
    r = R;
    if (u == d && l == r) {
      ind = sz++;
    } else
      ind = -1;
  }
};
vector<int> tr[100005];
void add(node *rt, int x, int y, int val) {
  if (x < rt->u || x > rt->d || y < rt->l || y > rt->r) return;
  if (rt->u == rt->d && rt->l == rt->r) {
    tr[rt->ind].push_back(val);
    return;
  }
  int mdx = (rt->u + rt->d) / 2;
  int mdy = (rt->l + rt->r) / 2;
  if (x <= mdx && y <= mdy) {
    if (rt->ch[0] == NULL) {
      rt->ch[0] = new node(rt->u, mdx, rt->l, mdy);
    }
    add(rt->ch[0], x, y, val);
  }
  if (x <= mdx && y > mdy) {
    if (rt->ch[1] == NULL) {
      rt->ch[1] = new node(rt->u, mdx, mdy + 1, rt->r);
    }
    add(rt->ch[1], x, y, val);
  }
  if (x > mdx && y <= mdy) {
    if (rt->ch[2] == NULL) {
      rt->ch[2] = new node(mdx + 1, rt->d, rt->l, mdy);
    }
    add(rt->ch[2], x, y, val);
  }
  if (x > mdx && y > mdy) {
    if (rt->ch[3] == NULL) {
      rt->ch[3] = new node(mdx + 1, rt->d, mdy + 1, rt->r);
    }
    add(rt->ch[3], x, y, val);
  }
}
bool ret(node *rt, int d, int r, vector<int> &res) {
  if (rt == NULL) return false;
  if (d < rt->u || r < rt->l) return false;
  if (rt->ind != -1) {
    for (int i = 0; i < tr[rt->ind].size(); i++) {
      res.push_back(tr[rt->ind][i]);
    }
    delete rt;
    return true;
  }
  bool in = (rt->r <= r && rt->d <= d);
  for (int i = 0; i < 4; i++) {
    if (ret(rt->ch[i], d, r, res)) rt->ch[i] = NULL;
  }
  if (in) delete rt;
  return in;
}
int main() {
  int n;
  scanf("%d", &n);
  sz = 0;
  pair<spell, spell> toComp[100005];
  vector<int> As;
  vector<int> Bs;
  for (int i = 0; i < n; i++) {
    int a, b, c, d;
    scanf("%d %d %d %d", &a, &b, &c, &d);
    toComp[i].first = spell(a, b);
    toComp[i].second = spell(c, d);
    As.push_back(a);
    As.push_back(c);
    Bs.push_back(b);
    Bs.push_back(d);
  }
  sort(As.begin(), As.end());
  sort(Bs.begin(), Bs.end());
  As.resize(unique(As.begin(), As.end()) - As.begin());
  Bs.resize(unique(Bs.begin(), Bs.end()) - Bs.begin());
  node *rt = new node(0, As.size(), 0, Bs.size());
  int dis[100005];
  memset(dis, -1, sizeof(dis));
  int p[100005];
  memset(p, -1, sizeof(dis));
  queue<int> q;
  for (int i = 0; i < n; i++) {
    int a, b, c, d;
    a = lower_bound(As.begin(), As.end(), toComp[i].first.c) - As.begin();
    b = lower_bound(Bs.begin(), Bs.end(), toComp[i].first.d) - Bs.begin();
    c = lower_bound(As.begin(), As.end(), toComp[i].second.c) - As.begin();
    d = lower_bound(Bs.begin(), Bs.end(), toComp[i].second.d) - Bs.begin();
    all[i] = spell(c, d);
    if (toComp[i].first.c == 0 && toComp[i].first.d == 0) {
      dis[i] = 1;
      q.push(i);
    } else {
      add(rt, a, b, i);
    }
  }
  vector<int> ind;
  while (!q.empty()) {
    int cur = q.front();
    q.pop();
    ind.clear();
    if (ret(rt, all[cur].c, all[cur].d, ind)) rt = NULL;
    for (int j = 0; j < ind.size(); j++) {
      dis[ind[j]] = dis[cur] + 1;
      p[ind[j]] = cur;
      q.push(ind[j]);
    }
  }
  printf("%d\n", dis[n - 1]);
  if (dis[n - 1] == -1) {
    return 0;
  }
  stack<int> st;
  int cur = n - 1;
  while (cur != -1) {
    st.push(cur + 1);
    cur = p[cur];
  }
  while (!st.empty()) {
    printf("%d ", st.top());
    st.pop();
  }
  printf("\n");
}
