#include <bits/stdc++.h>
using namespace std;
queue<int> q;
set<pair<int, int> > t[100100 << 1];
vector<int> ret;
set<pair<int, int> >::iterator it;
int n, de[100100 << 1], a[100100], b[100100], c[100100], d[100100], dis[100100],
    pre[100100];
void insert(int x, pair<int, int> v) {
  for (; x <= (*de); x += x & -x) t[x].insert(v);
}
void dele(int x, pair<int, int> v) {
  for (; x <= (*de); x += x & -x) t[x].erase(v);
}
void query(int x, int y) {
  ret.clear();
  for (; x; x -= x & -x) {
    it = t[x].begin();
    while (it != t[x].end() && (*it).first <= y)
      ret.push_back((*it).second), it++;
  }
}
void print(int x) {
  if (!pre[x])
    printf("%d", x);
  else {
    print(pre[x]);
    printf(" %d", x);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d%d", a + i, b + i, c + i, d + i);
    de[++*de] = a[i];
    de[++*de] = c[i];
  }
  sort(de + 1, de + *de + 1);
  *de = unique(de + 1, de + *de + 1) - (de + 1);
  for (int i = 1; i <= n; i++) {
    a[i] = lower_bound(de + 1, de + *de + 1, a[i]) - de;
    c[i] = lower_bound(de + 1, de + *de + 1, c[i]) - de;
  }
  if (de[1]) return puts("-1"), 0;
  for (int i = 1; i <= n; i++)
    if (a[i] == 1 && !b[i])
      q.push(i), dis[i] = 1;
    else
      insert(a[i], make_pair(b[i], i));
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    query(c[u], d[u]);
    int sz = ret.size();
    for (int i = 0; i <= sz - 1; i++) {
      dis[ret[i]] = dis[u] + 1;
      pre[ret[i]] = u;
      dele(a[ret[i]], make_pair(b[ret[i]], ret[i]));
      q.push(ret[i]);
    }
  }
  if (dis[n])
    printf("%d\n", dis[n]), print(n);
  else
    puts("-1");
}
