#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 99, M = 2e5 + 2;
int n, v, fa, a[N], b[N], c[N], d[N], sa[N], sb[N], sc[N], sd[N], par[N],
    mark[N], dist[N];
vector<pair<int, int> > tree[N];
map<int, int> ta, tb;
vector<int> ans;
queue<int> q;
void add(int x, int y, int an) {
  x += M;
  for (; x; x /= 2) tree[x].push_back(make_pair(y, an));
}
void make() {
  for (int i = 1; i < 2 * M; i++) {
    sort(tree[i].begin(), tree[i].end());
    reverse(tree[i].begin(), tree[i].end());
  }
}
void do_it() {
  int cnt1 = 0, cnt2 = 0, cnt3 = 0, cnt4 = 0;
  sort(sa, sa + 1 + n + n);
  sort(sb, sb + 1 + n + n);
  for (int i = 0; i < 2 * n + 1; i++) {
    if (i == 0 || sa[i] != sa[i - 1]) ta[sa[i]] = cnt1++;
    if (i == 0 || sb[i] != sb[i - 1]) tb[sb[i]] = cnt2++;
  }
  for (int i = 1; i < n + 1; i++) {
    a[i] = ta[a[i]];
    b[i] = tb[b[i]];
    c[i] = ta[c[i]];
    d[i] = tb[d[i]];
    add(a[i], b[i], i);
  }
}
void mv(int x, int y) {
  while (tree[x].size() && tree[x][tree[x].size() - 1].first <= y) {
    if (mark[tree[x][tree[x].size() - 1].second])
      tree[x].pop_back();
    else {
      q.push(tree[x][tree[x].size() - 1].second);
      par[tree[x][tree[x].size() - 1].second] = v;
      dist[tree[x][tree[x].size() - 1].second] = fa + 1;
      mark[tree[x][tree[x].size() - 1].second] = 1;
      tree[x].pop_back();
    }
  }
}
void query(int l, int r, int c) {
  r++;
  for (l += M, r += M; l < r; l >>= 1, r >>= 1) {
    if (l & 1) mv(l++, c);
    if (r & 1) mv(--r, c);
  }
}
void bfs() {
  q.push(0);
  while (q.size()) {
    int u = q.front();
    v = u, q.pop();
    fa = dist[u];
    query(0, c[u], d[u]);
  }
  v = n;
  while (ans.size() < dist[n]) {
    ans.push_back(v);
    v = par[v];
  }
  reverse(ans.begin(), ans.end());
}
int main() {
  cin >> n;
  for (int i = 1; i < n + 1; i++) {
    scanf("%d%d", &a[i], &b[i]);
    ;
    scanf("%d%d", &c[i], &d[i]);
    ;
    sa[i * 2 - 1] = a[i], sb[i * 2 - 1] = b[i];
    sa[i * 2] = c[i], sb[i * 2] = d[i];
  }
  do_it();
  make();
  bfs();
  cout << (dist[n] == 0 ? -1 : dist[n]) << endl;
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  cout << endl;
  ;
}
