#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, inf = 2e9;
int n, dp[N], p[N], need;
pair<int, int> t[5 * N];
struct my {
  int a, b, c, d, id;
};
my a[N];
inline bool cmp(my a, my b) { return a.a < b.a; }
void update(int v, int l, int r, int pos, int val) {
  if (l == r) {
    t[v] = make_pair(val, pos);
    return;
  }
  int mid = (r + l) >> 1;
  if (pos <= mid) {
    update(v + v, l, mid, pos, val);
  } else {
    update(v + v + 1, mid + 1, r, pos, val);
  }
  t[v] = min(t[v + v], t[v + v + 1]);
}
pair<int, int> get(int v, int l, int r, int tl, int tr) {
  if (l > r || l > tr || tl > r) {
    return make_pair(inf, inf);
  }
  if (tl <= l && r <= tr) {
    return t[v];
  }
  int mid = (r + l) >> 1;
  return min(get(v + v, l, mid, tl, tr), get(v + v + 1, mid + 1, r, tl, tr));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].a >> a[i].b >> a[i].c >> a[i].d;
    dp[i] = inf;
    a[i].id = i;
  }
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    if (a[i].id == n) {
      need = i;
    }
    update(1, 1, n, i, a[i].b);
  }
  a[n + 1].c = a[n + 1].d = 0;
  set<pair<int, int> > q;
  q.insert(make_pair(0, n + 1));
  dp[n + 1] = 0;
  while (!q.empty()) {
    int v = q.begin()->second;
    q.erase(q.begin());
    int l = 1, r = n;
    while (r - l > 1) {
      int mid = (r + l) >> 1;
      if (a[mid].a > a[v].c) {
        r = mid;
      } else {
        l = mid;
      }
    }
    if (a[l].a > a[v].c) {
      continue;
    }
    if (a[r].a > a[v].c) {
      r = l;
    }
    while (true) {
      auto it = get(1, 1, n, 1, r);
      if (it.first > a[v].d) {
        break;
      }
      int nxt = it.second;
      if (dp[nxt] > dp[v] + 1) {
        q.erase(make_pair(dp[nxt], nxt));
        dp[nxt] = dp[v] + 1;
        q.insert(make_pair(dp[nxt], nxt));
        update(1, 1, n, nxt, inf);
        p[nxt] = v;
      }
    }
  }
  if (dp[need] == inf) {
    return cout << "-1", 0;
  }
  cout << dp[need] << "\n";
  vector<int> ans;
  while (true) {
    ans.push_back(need);
    need = p[need];
    if (need == n + 1) {
      break;
    }
  }
  reverse(ans.begin(), ans.end());
  for (auto it : ans) {
    cout << a[it].id << " ";
  }
}
