#include <bits/stdc++.h>
using namespace std;
const int SIZ = (1 << 20);
pair<int, int> tree[2 * SIZ];
void insert(int a, pair<int, int> v) {
  a += SIZ + 1;
  tree[a] = v;
  a /= 2;
  while (a > 0) {
    tree[a] = min(tree[a * 2], tree[a * 2 + 1]);
    a /= 2;
  }
}
pair<int, int> getMin(int a, int b) {
  a += SIZ;
  b += SIZ + 2;
  pair<int, int> res = {2e9, -1};
  while (a + 1 != b) {
    if (a % 2 == 0) res = min(res, tree[a + 1]);
    if (b % 2 == 1) res = min(res, tree[b - 1]);
    a /= 2;
    b /= 2;
  }
  return res;
}
int32_t main() {
  ios::sync_with_stdio(false);
  for (int i = 0; i < 2 * SIZ; i++) tree[i] = {2e9, -1};
  int n;
  cin >> n;
  vector<pair<int, int> > cordsX(2 * n);
  vector<vector<int> > tab(n);
  for (int i = 0; i < n; i++) {
    int x, y, a, b;
    cin >> x >> y >> a >> b;
    tab[i] = {x, y, a, b};
    cordsX[i] = {x, i};
    cordsX[i + n] = {a, i + n};
  }
  sort(cordsX.begin(), cordsX.end());
  queue<int> que;
  vector<int> dist(n, -1);
  vector<int> prev(n, -1);
  for (int i = 0; i < n; i++) {
    bool start = false;
    if (tab[i][0] == 0 && tab[i][1] == 0) {
      que.push(i);
      dist[i] = 1;
      start = true;
    }
    tab[i][0] = lower_bound(cordsX.begin(), cordsX.end(),
                            pair<int, int>(tab[i][0], i)) -
                cordsX.begin();
    tab[i][2] = lower_bound(cordsX.begin(), cordsX.end(),
                            pair<int, int>(tab[i][2], i + n)) -
                cordsX.begin();
    if (start == false) insert(tab[i][0], pair<int, int>(tab[i][1], i));
  }
  while (!que.empty()) {
    int cur = que.front();
    que.pop();
    int xEnd = tab[cur][2], yEnd = tab[cur][3];
    for (;;) {
      pair<int, int> val = getMin(0, xEnd);
      if (val.first > yEnd) break;
      que.push(val.second);
      dist[val.second] = dist[cur] + 1;
      prev[val.second] = cur;
      insert(tab[val.second][0], pair<int, int>(2e9, -1));
    }
  }
  if (dist[n - 1] < 0) {
    cout << -1 << endl;
    return 0;
  }
  cout << dist[n - 1] << "\n";
  int cur = n - 1;
  vector<int> ans;
  while (cur != -1) {
    ans.push_back(cur);
    cur = prev[cur];
  }
  for (int i = ans.size() - 1; i >= 0; i--) cout << ans[i] + 1 << " ";
  cout << endl;
}
