#include <bits/stdc++.h>
const int INF = 0x3f3f3f3f;
using namespace std;
const int N = 1e5 + 10;
struct node {
  int a, b, c, d;
  node(int a, int b, int c, int d) : a(a), b(b), c(c), d(d) {}
  node() {}
};
int n;
node vec[N];
vector<pair<int, int> > vx;
int st[4 * N];
int getid(int x) {
  return upper_bound(vx.begin(), vx.end(), pair<int, int>(x, INF)) - vx.begin();
}
int getid(int x, int y) {
  return upper_bound(vx.begin(), vx.end(), pair<int, int>(x, y)) - vx.begin();
}
void upd(int p, int l, int r, int x, int v) {
  if (l > x || r < x) return;
  if (l == r) {
    st[p] = v;
    return;
  }
  int mi = (l + r) / 2;
  upd(p << 1, l, mi, x, v);
  upd(p << 1 | 1, mi + 1, r, x, v);
  if (vec[st[p << 1]].b < vec[st[p << 1 | 1]].b)
    st[p] = st[p << 1];
  else
    st[p] = st[p << 1 | 1];
}
int que(int p, int l, int r, int x, int y) {
  if (l > y || r < x) return 0;
  if (l >= x && r <= y) return st[p];
  int mi = (l + r) / 2;
  int q1 = que(p << 1, l, mi, x, y);
  int q2 = que(p << 1 | 1, mi + 1, r, x, y);
  if (vec[q1].b < vec[q2].b) return q1;
  return q2;
}
void solve() {
  for (int u = 1; u <= n; u++) upd(1, 1, n, u, vx[u - 1].second);
  queue<int> q;
  vector<int> prv(n + 1, -1);
  q.push(0);
  prv[0] = 0;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    int ux = u;
    u = getid(vec[u].c);
    while (1) {
      int v = que(1, 1, n, 1, u);
      if (vec[v].b > vec[ux].d) break;
      prv[v] = ux;
      upd(1, 1, n, getid(vec[v].a, v), 0);
      q.push(v);
    }
  }
  if (prv[n] == -1) {
    cout << "-1\n";
    return;
  }
  vector<int> pa;
  for (int u = n; u != 0; u = prv[u]) pa.push_back(u);
  cout << pa.size() << endl;
  for (int j = pa.size() - 1; j >= 0; j--) cout << pa[j] << " ";
  cout << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  vec[0] = node(INF, INF, 0, 0);
  for (int i = 1; i <= n; i++) {
    cin >> vec[i].a >> vec[i].b >> vec[i].c >> vec[i].d;
    vx.push_back(pair<int, int>(vec[i].a, i));
  }
  sort(vx.begin(), vx.end());
  solve();
  return 0;
}
