#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
bool vis[maxn << 1];
int n, m, a[maxn], b[maxn], c[maxn], d[maxn];
map<int, int> mat;
set<pair<int, int> > cc[maxn << 1];
vector<int> vx;
int lowbit(int x) { return x & -x; }
void modify(int x, pair<int, int> val) {
  while (x <= m) {
    cc[x].insert(val);
    x += lowbit(x);
  }
}
vector<int> query(int x, int y) {
  vector<int> tem;
  while (x) {
    set<pair<int, int> >::iterator last = cc[x].upper_bound(make_pair(y, maxn));
    set<pair<int, int> >::iterator it;
    for (it = cc[x].begin(); it != last; it++) tem.push_back(it->second);
    cc[x].erase(cc[x].begin(), last);
    x -= lowbit(x);
  }
  return tem;
}
int dist[maxn], fa[maxn], path[maxn];
void bfs() {
  memset(fa, -1, sizeof(fa));
  memset(dist, -1, sizeof(dist));
  vector<int> u = query(mat[0], 0);
  queue<int> q;
  for (int i = 0; i < (int)u.size(); ++i)
    q.push(u[i]), vis[u[i]] = true, dist[u[i]] = 1;
  while (!q.empty()) {
    int id = q.front();
    q.pop();
    vector<int> v = query(mat[c[id]], d[id]);
    for (int i = 0; i < (int)v.size(); ++i) {
      if (vis[v[i]]) continue;
      vis[v[i]] = true;
      dist[v[i]] = dist[id] + 1;
      fa[v[i]] = id;
      q.push(v[i]);
    }
  }
}
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; ++i)
      scanf("%d%d%d%d", a + i, b + i, c + i, d + i), vx.push_back(a[i]),
          vx.push_back(c[i]);
    sort(vx.begin(), vx.end());
    m = 0;
    mat[vx[0]] = ++m;
    for (int i = 1; i < (int)vx.size(); ++i) {
      if (vx[i] > vx[i - 1]) mat[vx[i]] = ++m;
    }
    for (int i = 0; i < m + 1; ++i) cc[i].clear();
    for (int i = 0; i < n; ++i) modify(mat[a[i]], make_pair(b[i], i));
    bfs();
    printf("%d\n", dist[n - 1]);
    if (dist[n - 1] == -1) {
      continue;
    } else {
      int cnt = 0;
      int u = n - 1;
      while (u != -1) {
        path[cnt++] = u + 1;
        u = fa[u];
      }
      printf("%d", path[cnt - 1]);
      for (int i = cnt - 2; i > -1; --i) {
        printf(" %d", path[i]);
      }
      printf("\n");
    }
  }
  return 0;
}
