#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-9;
struct SegmTree {
  vector<pair<int, int> > t;
  int sz;
  SegmTree(int n = 0) {
    sz = 1;
    while (sz < n) sz *= 2;
    t.assign(sz * 2, make_pair(-1, 0));
  }
  void put(int pos, int val) {
    int v = sz + pos;
    t[v] = make_pair(val, pos);
    v /= 2;
    while (v) {
      t[v] = max(t[v * 2], t[v * 2 + 1]);
      v /= 2;
    }
  }
  pair<int, int> get_max(int l, int r) {
    pair<int, int> res(-1, 0);
    l += sz;
    r += sz;
    while (l <= r) {
      res = max(res, t[l]);
      res = max(res, t[r]);
      l = (l + 1) / 2;
      r = (r - 1) / 2;
    }
    return res;
  }
};
const int MAXN = 1e5 + 10;
int a[MAXN];
int b[MAXN];
int c[MAXN];
int d[MAXN];
int n;
SegmTree T;
vector<pair<int, int> > x;
bool read() {
  if (scanf("%d", &n) < 1) {
    return false;
  }
  for (int i = 0; i < (int)n; ++i) {
    scanf("%d%d%d%d", &a[i], &b[i], &c[i], &d[i]);
  }
  return true;
}
void build() {
  for (int i = 0; i < (int)n; ++i) {
    x.push_back(make_pair(c[i], i));
  }
  sort(begin(x), end(x));
  T = SegmTree(((int)(x).size()));
  for (int i = 0; i < (int)n; ++i) {
    int pos = lower_bound(begin(x), end(x), make_pair(c[i], i)) - x.begin();
    assert(pos < ((int)(x).size()));
    assert(x[pos] == make_pair(c[i], i));
    T.put(pos, d[i]);
  }
}
vector<int> solve() {
  build();
  vector<int> nxt(n, -1);
  vector<int> ps;
  ps.push_back(n - 1);
  int pos =
      lower_bound(begin(x), end(x), make_pair(c[n - 1], n - 1)) - x.begin();
  T.put(pos, -1);
  for (int it = 0; !ps.empty(); ++it) {
    for (int i : ps) {
      if (a[i] == 0 && b[i] == 0) {
        vector<int> ans;
        for (int j = i; j != -1; j = nxt[j]) {
          ans.push_back(j);
        }
        return ans;
      }
    }
    vector<int> nps;
    for (int i : ps) {
      int low_x = a[i];
      int low_y = b[i];
      low_x = upper_bound(begin(x), end(x), make_pair(low_x, -1)) - x.begin();
      while (1) {
        pair<int, int> cur = T.get_max(low_x, ((int)(x).size()) - 1);
        if (cur.first < low_y) {
          break;
        }
        int id = x[cur.second].second;
        nxt[id] = i;
        nps.push_back(id);
        T.put(cur.second, -1);
      }
    }
    ps.swap(nps);
  }
  return {};
}
int main() {
  while (read()) {
    vector<int> ans = solve();
    if (ans.empty()) {
      puts("-1");
    } else {
      printf("%d\n", ((int)(ans).size()));
      for (int i : ans) {
        printf("%d ", i + 1);
      }
      puts("");
    }
  }
  return 0;
}
