#include <bits/stdc++.h>
using namespace std;
inline void EnableFileIO(const string &fileName) {
  if (fileName.empty()) return;
  freopen((fileName + ".in").c_str(), "r", stdin);
  freopen((fileName + ".out").c_str(), "w", stdout);
  return;
}
const int INF = (1 << 30) - 1;
const long long LINF = (1LL << 61) - 1;
const double EPS = 1e-10;
const int N = 2e5 + 100;
int n;
int a[N], b[N], c[N], d[N];
int dist[N], pre[N];
vector<int> X;
multimap<int, int> bit[N];
void add(int p, int u, int v) {
  for (++p; p < N; p += p & -p) {
    bit[p].insert(make_pair(u, v));
  }
}
void get(int p, int u, vector<int> &res) {
  res.clear();
  for (++p; p; p -= p & -p) {
    while (!bit[p].empty() && bit[p].begin()->first <= u) {
      res.push_back(bit[p].begin()->second);
      bit[p].erase(bit[p].begin());
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  EnableFileIO("");
  srand((int)time(NULL));
  queue<int> que;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    X.push_back(a[i]), X.push_back(c[i]);
    if (a[i] == 0 && b[i] == 0) {
      dist[i] = 1, pre[i] = -1;
      que.push(i);
    }
  }
  sort(X.begin(), X.end());
  X.erase(unique(X.begin(), X.end()), X.end());
  for (int i = 0; i < n; i++) {
    a[i] = (int)(lower_bound(X.begin(), X.end(), a[i]) - X.begin());
    c[i] = (int)(lower_bound(X.begin(), X.end(), c[i]) - X.begin());
    add(a[i], b[i], i);
  }
  while (!que.empty()) {
    int id = que.front();
    que.pop();
    int x = c[id], y = d[id];
    vector<int> nxt;
    get(x, y, nxt);
    for (int i = 0; i < nxt.size(); i++) {
      if (!dist[nxt[i]]) {
        dist[nxt[i]] = dist[id] + 1;
        pre[nxt[i]] = id;
        que.push(nxt[i]);
      }
    }
  }
  if (!dist[n - 1]) {
    cout << -1 << endl;
  } else {
    cout << dist[n - 1] << endl;
    vector<int> ans;
    int c = n - 1;
    while (c != -1) {
      ans.push_back(c);
      c = pre[c];
    }
    reverse(ans.begin(), ans.end());
    for (int i = 0; i < ans.size(); i++) cout << ans[i] + 1 << ' ';
    cout << endl;
  }
  return 0;
}
