#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, INF = 1e9 + 10;
int a[N], b[N], c[N], d[N], pos[N], par[N], seg[4 * N], n;
pair<int, int> v[N];
bool vis[N];
void upd(int x, int val, int s = 0, int e = n, int id = 1) {
  if (x < s || x >= e) return;
  if (e - s == 1) {
    seg[id] = val;
    return;
  }
  int mid = (s + e) / 2;
  upd(x, val, s, mid, 2 * id);
  upd(x, val, mid, e, 2 * id + 1);
  seg[id] = seg[2 * id];
  if (b[seg[2 * id + 1]] < b[seg[id]]) seg[id] = seg[2 * id + 1];
}
int get(int l, int r, int s = 0, int e = n, int id = 1) {
  if (r <= s || e <= l) return -1;
  if (l <= s && e <= r) return seg[id];
  int mid = (s + e) / 2;
  int left = get(l, r, s, mid, 2 * id), right = get(l, r, mid, e, 2 * id + 1);
  if (left == -1) return right;
  if (right == -1) return left;
  if (b[left] < b[right])
    return left;
  else
    return right;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    v[i] = pair<int, int>(a[i], i);
  }
  sort(v, v + n);
  for (int i = 0; i < n; i++) upd(i, v[i].second);
  queue<int> q;
  for (int i = 0; i < n; i++) {
    int ind = v[i].second;
    pos[ind] = i;
    if (v[i].first == 0 && b[ind] == 0) {
      b[ind] = INF;
      upd(i, ind);
      q.push(ind);
      par[ind] = -1;
    }
  }
  while (q.size()) {
    int ver = q.front();
    q.pop();
    vis[ver] = true;
    while (true) {
      int ind = upper_bound(v, v + n, pair<int, int>(c[ver], INF)) - v;
      if (ind == 0) break;
      int cur = get(0, ind);
      if (b[cur] <= d[ver]) {
        b[cur] = INF;
        upd(pos[cur], cur);
        q.push(cur);
        par[cur] = ver;
      } else
        break;
    }
  }
  if (!vis[n - 1]) {
    cout << "-1\n";
    return 0;
  }
  vector<int> p;
  int id = n - 1;
  while (id >= 0) {
    p.push_back(id);
    id = par[id];
  }
  reverse(p.begin(), p.end());
  cout << p.size() << "\n";
  for (auto i : p) cout << i + 1 << " ";
  cout << "\n";
  return 0;
}
