#include <bits/stdc++.h>
using namespace std;
int n, a[202020], aux[202020], b[202020], c[202020], d[202020], dist[202020],
    pai[202020];
set<pair<int, int> > bit[202020];
void upd(int p, pair<int, int> v) {
  for (p++; p < 202020; p += p & -p) bit[p].insert(v);
}
vector<int> query(int p, int v) {
  vector<int> ret;
  for (p++; p > 0; p -= p & -p) {
    while (((int)(bit[p]).size())) {
      auto it = bit[p].upper_bound(make_pair(v, 1e9));
      if (it == bit[p].begin()) break;
      it--;
      if (dist[it->second] == -1) ret.emplace_back(it->second);
      bit[p].erase(it);
    }
  }
  return ret;
}
int main() {
  memset(dist, -1, sizeof(dist));
  queue<int> fila;
  scanf("%d", &n);
  for (int i = (0); i < (n); i++) {
    scanf("%d%d%d%d", a + i, b + i, c + i, d + i);
    aux[2 * i] = a[i];
    aux[2 * i + 1] = c[i];
    if (a[i] == 0 && b[i] == 0) fila.push(i), dist[i] = 0;
  }
  sort(aux, aux + 2 * n);
  for (int i = (0); i < (n); i++) {
    a[i] = lower_bound(aux, aux + 2 * n, a[i]) - aux;
    c[i] = lower_bound(aux, aux + 2 * n, c[i]) - aux;
    if (dist[i] == -1) upd(a[i], make_pair(b[i], i));
  }
  while (!fila.empty()) {
    int v = fila.front();
    fila.pop();
    if (v == n - 1) {
      vector<int> ans;
      while (1) {
        ans.emplace_back(v);
        if (!dist[v]) break;
        v = pai[v];
      }
      reverse((ans).begin(), (ans).end());
      printf("%d\n", ((int)(ans).size()));
      for (int i = (0); i < (((int)(ans).size())); i++)
        printf("%d%c", ans[i] + 1, " \n"[i == ((int)(ans).size()) - 1]);
      return 0;
    }
    vector<int> adj = query(c[v], d[v]);
    for (int u : adj) {
      dist[u] = dist[v] + 1;
      pai[u] = v;
      fila.push(u);
    }
  }
  puts("-1");
}
