#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
struct point {
  int x, y;
} s[N], t[N];
vector<int> q[2];
int cntx, cnty, vis[N], n, now, dis[N], S, ax[N], ay[N];
set<pair<int, int> > a[N];
set<pair<int, int> >::iterator it;
int lowbit(int x) { return x & (-x); }
void upd(int x, pair<int, int> y) {
  while (x <= cntx) {
    a[x].insert(y);
    x += lowbit(x);
  }
}
void get(int x, int y, int id) {
  while (x) {
    it = a[x].begin();
    for (pair<int, int> i : a[x]) {
      if (i.first > y) break;
      it++;
      if (vis[i.second]) continue;
      q[now].push_back(i.second);
      vis[i.second] = id;
    }
    a[x].erase(a[x].begin(), it);
    x -= lowbit(x);
  }
}
void bfs(int d) {
  if (!q[now].size()) return;
  if (vis[n]) return;
  now ^= 1;
  q[now].clear();
  for (int x : q[now ^ 1]) get(t[x].x, t[x].y, x);
  for (int x : q[now]) dis[x] = d;
  bfs(d + 1);
}
int main() {
  scanf("%d", &n);
  memset(dis, 0x3f, sizeof(dis));
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d%d", &s[i].x, &s[i].y, &t[i].x, &t[i].y);
    if (s[i].x == 0 && s[i].y == 0) {
      q[0].push_back(i);
      dis[i] = 1, vis[i] = -1;
    }
    ax[++cntx] = s[i].x, ax[++cntx] = t[i].x;
    ay[++cnty] = s[i].y, ay[++cnty] = t[i].y;
  }
  sort(ax + 1, ax + cntx + 1);
  sort(ay + 1, ay + cnty + 1);
  cntx = unique(ax + 1, ax + cntx + 1) - ax - 1;
  cnty = unique(ay + 1, ay + cnty + 1) - ay - 1;
  for (int i = 1; i <= n; i++) {
    s[i].x = lower_bound(ax + 1, ax + cntx + 1, s[i].x) - ax;
    s[i].y = lower_bound(ay + 1, ay + cnty + 1, s[i].y) - ay;
    upd(s[i].x, make_pair(s[i].y, i));
    t[i].x = lower_bound(ax + 1, ax + cntx + 1, t[i].x) - ax;
    t[i].y = lower_bound(ay + 1, ay + cnty + 1, t[i].y) - ay;
  }
  now = 0;
  bfs(2);
  if (!vis[n])
    puts("-1");
  else {
    printf("%d\n", dis[n]);
    int x = n, cnt = 0, ans[N];
    while (x != -1) {
      ans[++cnt] = x;
      x = vis[x];
    }
    for (int i = cnt; i >= 1; i--) printf("%d ", ans[i]);
  }
}
