#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int a[N], b[N], c[N], d[N], dis[N], pre[N];
bool vis[N];
set<pair<int, int> > t[N << 2];
int n;
int num[N << 2], tot = 0;
bool flag = 0;
int lowbit(int x) { return (x & (-x)); }
void modify(int x, int y, int id) {
  for (; x <= tot; x += lowbit(x)) {
    t[x].insert(make_pair(y, id));
  }
  return;
}
vector<int> query(int xx) {
  int x = a[xx], y = b[xx];
  vector<int> ret;
  for (; x; x -= lowbit(x)) {
    set<pair<int, int> > &now = t[x];
    while (1) {
      set<pair<int, int> >::iterator it = t[x].lower_bound(make_pair(y, 0));
      if (it == t[x].end()) break;
      ret.push_back(it->second);
      t[x].erase(it);
    }
  }
  return ret;
}
void print(int x) {
  printf("%d\n", dis[x]);
  for (int u = x; ~u; u = pre[u]) printf("%d ", u);
  puts("");
  return;
}
void bfs() {
  queue<int> q;
  q.push(n);
  dis[n] = 1;
  pre[n] = -1;
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    if ((a[x] == tot) && (!b[x])) {
      print(x);
      return;
    }
    vector<int> ret = query(x);
    for (int i = 0; i < ret.size(); ++i) {
      int v = ret[i];
      if (vis[v]) continue;
      vis[v] = 1;
      q.push(v);
      dis[v] = dis[x] + 1;
      pre[v] = x;
    }
  }
  puts("-1");
  return;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d%d%d", &a[i], &b[i], &c[i], &d[i]);
    if ((!a[i]) && (!b[i])) {
      flag = 1;
    }
    num[++tot] = a[i];
    num[++tot] = c[i];
  }
  if (!flag) {
    puts("-1");
    return 0;
  }
  sort(num + 1, num + 1 + tot);
  tot = unique(num + 1, num + 1 + tot) - num - 1;
  for (int i = 1; i <= n; ++i) {
    a[i] = tot - (lower_bound(num + 1, num + 1 + tot, a[i]) - num) + 1;
    c[i] = tot - (lower_bound(num + 1, num + 1 + tot, c[i]) - num) + 1;
    if (i != n) modify(c[i], d[i], i);
  }
  bfs();
  return 0;
}
