#include <bits/stdc++.h>
using namespace std;
const int INF = 0x7fffffff;
int N;
set<pair<int, int> > F[222222];
pair<int, int> pos[222222], to[222222];
map<int, int> Dx;
vector<int> xlist;
int dis[222222];
queue<int> Q;
void add(int x, int ord) {
  for (; x <= 2 * N; x += x & (-x))
    F[x].insert(make_pair(pos[ord].second, ord));
}
void del(pair<int, int> f) {
  int ord = f.second, x = Dx[pos[ord].first], y = f.first;
  for (int i = x; i <= 2 * N; i += i & (-i)) F[i].erase(f);
}
pair<int, int> L[222222];
int ln;
void del_list() {
  for (int i = 1; i <= ln; i++) del(L[i]);
  ln = 0;
}
int from[222222];
void add_to_list(int x, int y, int bs, int f) {
  ln = 0;
  set<pair<int, int> >::iterator it = F[x].upper_bound(make_pair(y, INF));
  for (set<pair<int, int> >::iterator i = F[x].begin(); i != it; i++) {
    L[++ln] = *i;
    Q.push(i->second);
    dis[i->second] = bs + 1;
    from[i->second] = f;
  }
  del_list();
}
void Out(int x) {
  if (!x) return;
  Out(from[x]);
  printf("%d ", x);
}
int main() {
  scanf("%d", &N);
  for (int i = 1, x1, y1, x2, y2; i <= N; i++) {
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    pos[i] = make_pair(x1, y1);
    to[i] = make_pair(x2, y2);
    xlist.push_back(x1);
    xlist.push_back(x2);
  }
  sort(xlist.begin(), xlist.end());
  for (int i = 0, t = 0; i < xlist.size(); i++) {
    if (!i || xlist[i] != xlist[i - 1]) t++;
    Dx[xlist[i]] = t;
  }
  for (int i = 1; i <= N; i++) {
    add(Dx[pos[i].first], i);
  }
  for (int i = 1; i <= N; i++)
    if (pos[i] == make_pair(0, 0)) {
      Q.push(i);
      dis[i] = 1;
      del(make_pair(pos[i].second, i));
    }
  while (!Q.empty()) {
    int n = Q.front(), bs = dis[n];
    Q.pop();
    for (int i = Dx[to[n].first]; i; i -= i & (-i)) {
      add_to_list(i, to[n].second, bs, n);
    }
  }
  if (dis[N]) {
    printf("%d\n", dis[N]);
    Out(N);
  } else {
    printf("-1\n");
  }
}
