#include <bits/stdc++.h>
using namespace std;
int tree[800011];
int pa[200011];
struct spell {
  int a, b, c, d, ind, dis;
  spell(){};
  spell(int _a, int _b, int _c, int _d, int _ind, int _dis) {
    a = _a;
    b = _b;
    c = _c;
    d = _d;
    ind = _ind;
    dis = _dis;
  }
};
int cur = 0;
vector<spell> v;
queue<spell> q;
int par;
struct node {
  int l, r, id;
  node() {}
  node(int _l, int _r, int _id) {
    l = _l;
    r = _r;
    id = _id;
  }
  node left() { return node(l, (l + r) / 2, 2 * id); }
  node right() { return node((l + r) / 2 + 1, r, 2 * id + 1); }
  void build() {
    if (l != r) {
      left().build();
      right().build();
      tree[id] = min(tree[2 * id], tree[2 * id + 1]);
    } else {
      tree[id] = v[l - 1].b;
    }
  }
  void go(int x, int val) {
    if (x < l or tree[id] > val) return;
    if (l == r) {
      v[l - 1].dis = cur;
      q.push(v[l - 1]);
      pa[v[l - 1].ind] = par;
      tree[id] = INT_MAX;
      return;
    }
    int mid = (l + r) / 2;
    if (x <= mid) {
      if (tree[2 * id] <= val) left().go(x, val);
    } else {
      if (tree[2 * id] <= val) left().go(x, val);
      if (tree[2 * id + 1] <= val) right().go(x, val);
    }
    tree[id] = min(tree[2 * id], tree[2 * id + 1]);
  }
};
bool func(spell a, spell b) { return a.a < b.a; }
int ans[200011];
int main() {
  int n, a, b, c, d;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b >> c >> d;
    v.push_back({a, b, c, d, i + 1, 0});
  }
  sort(v.begin(), v.end(), func);
  q.push(spell(0, 0, 0, 0, 0, 0));
  spell t;
  node stree(1, v.size(), 1);
  stree.build();
  while (q.size()) {
    t = q.front();
    q.pop();
    par = t.ind;
    ans[t.ind] = t.dis;
    a = t.c;
    b = t.d;
    cur = t.dis + 1;
    int lo = 0;
    int hi = n;
    int mid;
    while (hi - lo > 1) {
      mid = (hi + lo) / 2;
      if (v[mid].a <= a)
        lo = mid;
      else
        hi = mid;
    }
    if (v[lo].a <= a) stree.go(lo + 1, b);
  }
  if (ans[n] == 0) {
    cout << -1;
    return 0;
  }
  cout << ans[n] << "\n";
  cur = n;
  vector<int> path;
  while (cur) {
    path.push_back(cur);
    cur = pa[cur];
  }
  for (int i = path.size() - 1; i >= 0; i--) {
    cout << path[i] << " ";
  }
}
