#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
pair<pair<int, int>, pair<int, int>> a[N];
unordered_map<int, int> xm, ym;
vector<int> seg[N * 4 + 10];
bool done[N];
void add(int node, int l, int r, int x, int y, int i) {
  if (y < l || y > r) return;
  seg[node].push_back(i);
  if (l == r) return;
  add(node * 2, l, (l + r) / 2, x, y, i);
  add(node * 2 + 1, (l + r) / 2 + 1, r, x, y, i);
}
vector<int> cur;
void query(int node, int l, int r, int x, int y) {
  if (l > y) return;
  if (seg[node].empty()) return;
  if (y >= r) {
    while (!seg[node].empty() && a[seg[node].back()].first.first <= x) {
      if (!done[seg[node].back()]) {
        cur.push_back(seg[node].back());
        done[seg[node].back()] = true;
      }
      seg[node].pop_back();
    }
  } else {
    query(node * 2, l, (l + r) / 2, x, y);
    query(node * 2 + 1, (l + r) / 2 + 1, r, x, y);
  }
}
int main() {
  memset(done, false, sizeof(done));
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  pair<int, int> goal;
  int start;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first.first >> a[i].first.second >> a[i].second.first >>
        a[i].second.second;
  }
  goal = a[n - 1].first;
  set<int> xs, ys;
  for (int i = 0; i < n; i++) {
    xs.insert(a[i].first.first);
    xs.insert(a[i].second.first);
    ys.insert(a[i].first.second);
    ys.insert(a[i].second.second);
  }
  vector<int> xv(xs.begin(), xs.end()), yv(ys.begin(), ys.end());
  for (int i = 0; i < xv.size(); i++) xm[xv[i]] = i;
  for (int i = 0; i < yv.size(); i++) ym[yv[i]] = i;
  vector<pair<pair<int, int>, int>> added;
  for (int i = 0; i < n; i++) {
    added.push_back({a[i].first, i});
  }
  sort(added.begin(), added.end());
  reverse(added.begin(), added.end());
  for (int i = 0; i < n; i++)
    add(1, 0, 2 * n, xm[added[i].first.first], ym[added[i].first.second],
        added[i].second);
  queue<pair<pair<int, int>, pair<int, int>>> q;
  int from[n];
  q.push({{0, 0}, {0, -1}});
  while (!q.empty()) {
    cur.clear();
    int xp, yp, steps, cf;
    xp = q.front().first.first;
    yp = q.front().first.second;
    steps = q.front().second.first;
    cf = q.front().second.second;
    if (xp >= goal.first && yp >= goal.second) {
      cout << (steps + 1) << endl;
      vector<int> res;
      res.push_back(n - 1);
      while (cf != -1) {
        res.push_back(cf);
        cf = from[cf];
      }
      reverse(res.begin(), res.end());
      for (auto x : res) cout << (x + 1) << " ";
      cout << endl;
      return 0;
    }
    q.pop();
    query(1, 0, 2 * n, xp, ym[yp]);
    for (int i = 0; i < cur.size(); i++) {
      done[cur[i]] = true;
      from[cur[i]] = cf;
      q.push({{a[cur[i]].second.first, a[cur[i]].second.second},
              {steps + 1, cur[i]}});
    }
  }
  cout << -1 << endl;
  return 0;
}
