#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int M = 2e5 + 5, INF = 0x3f3f3f3f, mod = 1e9 + 7;
struct BIT {
  set<pair<int, int> > st[M];
  int n;
  void init(int n) {
    this->n = n;
    for (int j = 1; j <= n; j++) st[j].clear();
  }
  int lowbit(int x) { return x & (-x); }
  void update(int x, int y, int z) {
    for (int j = x; j <= n; j += lowbit(j)) {
      st[j].insert({y, z});
    }
  }
  vector<int> query(int x, int y) {
    vector<int> res;
    for (int j = x; j; j -= lowbit(j)) {
      auto it = st[j].upper_bound({y, INF});
      for (auto x = st[j].begin(); x != it; x++) {
        res.push_back(x->second);
      }
      st[j].erase(st[j].begin(), it);
    }
    return res;
  }
} bit;
vector<int> X;
int A[M], B[M], C[M], D[M];
bool mark[M];
int dis[M], pre[M];
void bfs() {
  memset(mark, 0, sizeof(mark));
  memset(dis, 63, sizeof(dis));
  queue<int> Q;
  vector<int> now = bit.query(1, 0);
  for (auto x : now) {
    if (mark[x]) continue;
    Q.push(x);
    dis[x] = 1;
    mark[x] = 1;
  }
  while (!Q.empty()) {
    int t = Q.front();
    Q.pop();
    now = bit.query(C[t], D[t]);
    for (auto x : now) {
      if (mark[x]) continue;
      if (dis[x] > dis[t] + 1) {
        dis[x] = dis[t] + 1;
        pre[x] = t;
        Q.push(x);
        mark[x] = 1;
      }
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int j = 1; j <= n; j++) {
    scanf("%d%d%d%d", &A[j], &B[j], &C[j], &D[j]);
    X.push_back(A[j]);
    X.push_back(C[j]);
  }
  sort(X.begin(), X.end());
  X.erase(unique(X.begin(), X.end()), X.end());
  for (int j = 1; j <= n; j++) {
    A[j] = lower_bound(X.begin(), X.end(), A[j]) - X.begin() + 1;
    C[j] = lower_bound(X.begin(), X.end(), C[j]) - X.begin() + 1;
  }
  bit.init(X.size());
  for (int j = 1; j <= n; j++) {
    bit.update(A[j], B[j], j);
  }
  bfs();
  if (dis[n] == INF)
    printf("-1\n");
  else {
    printf("%d\n", dis[n]);
    vector<int> ans;
    while (n) {
      ans.push_back(n);
      n = pre[n];
    }
    for (int j = ans.size() - 1; j >= 0; j--) {
      printf("%d ", ans[j]);
    }
    printf("\n");
  }
  return 0;
}
