#include <bits/stdc++.h>
using namespace std;
const int MX = 1e5 + 5, MXX = 23;
const long long mod = 1e9 + 7, inf = 1e18 + 6;
int a[MX], b[MX], c[MX], d[MX], sr[MX], par[MX];
bitset<MX> del;
queue<int> saf;
struct cmp {
  bool operator()(int i, int j) { return d[i] < d[j]; }
};
priority_queue<int, vector<int>, cmp> hp[MX << 1];
vector<int> tmp[MX << 1];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(9);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i] >> b[i] >> c[i] >> d[i];
  ++n;
  for (int i = 0; i < n; ++i) sr[i] = i;
  sort(sr, sr + n, [](int i, int j) { return c[i] < c[j]; });
  for (int i = n; i < 2 * n; ++i)
    hp[i].push(sr[i - n]), tmp[i].push_back(sr[i - n]);
  for (int i = n - 1; i; --i) {
    for (auto x : {i << 1, i << 1 | 1})
      for (auto y : tmp[x]) hp[i].push(y), tmp[i].push_back(y);
  }
  int st = n - 2, en = n - 1;
  saf.push(st), par[st] = -1, del[st] = 1;
  while (!saf.empty()) {
    int u = saf.front();
    saf.pop();
    if (u == en) {
      vector<int> ans;
      u = par[u];
      while (u != -1) ans.push_back(u + 1), u = par[u];
      cout << ans.size() << "\n";
      for (auto x : ans) cout << x << ' ';
      cout << "\n";
      return 0;
    }
    int l = -1, r = n;
    while (l + 1 < r) {
      int md = (l + r) >> 1;
      if (c[sr[md]] < a[u])
        l = md;
      else
        r = md;
    }
    auto clean = [=](int i) {
      while (!hp[i].empty()) {
        if (del[hp[i].top()]) {
          hp[i].pop();
          continue;
        }
        if (d[hp[i].top()] < b[u]) break;
        int v = hp[i].top();
        hp[i].pop();
        par[v] = u;
        del[v] = 1;
        saf.push(v);
      }
    };
    for (l = r + n, r = 2 * n; l < r; l >>= 1, r >>= 1) {
      if (l & 1) clean(l), l++;
      if (r & 1) --r, clean(r);
    }
  }
  cout << "-1\n";
  return 0;
}
