#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int vis[N], a[N], b[N], c[N], d[N], n, from[N], tot, A[N];
queue<int> q;
struct Tree {
  int l, r;
  set<pair<int, int> > S;
} T[N * 4];
int ef(int x) {
  int l = 0, r = tot;
  while (l < r) {
    int mid = (l + r + 1) / 2;
    if (A[mid] > x)
      r = mid - 1;
    else
      l = mid;
  }
  return l;
}
void build(int x, int l, int r) {
  T[x].l = l;
  T[x].r = r;
  if (l == r) return;
  int mid = (l + r) / 2;
  build(x * 2, l, mid);
  build(x * 2 + 1, mid + 1, r);
}
void insert(int x, int y, int z) {
  T[x].S.insert(make_pair(b[z], z));
  if (T[x].l == T[x].r) return;
  int mid = (T[x].l + T[x].r) / 2;
  if (y <= mid)
    insert(x * 2, y, z);
  else
    insert(x * 2 + 1, y, z);
}
void find(int x, int l, int r, int z) {
  if (T[x].l > r || l > T[x].r) return;
  if (T[x].l >= l && T[x].r <= r) {
    while (T[x].S.size()) {
      pair<int, int> now = *T[x].S.begin();
      if (now.first > d[z]) break;
      T[x].S.erase(T[x].S.begin());
      if (!vis[now.second])
        from[now.second] = z, q.push(now.second), vis[now.second] = 1;
    }
    return;
  }
  find(x * 2, l, r, z);
  find(x * 2 + 1, l, r, z);
}
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]), A[i] = a[i];
  sort(A + 1, A + n + 1);
  tot = 1;
  for (int i = 2; i <= n; i++)
    if (A[i] != A[tot]) A[++tot] = A[i];
  build(1, 1, tot);
  for (int i = 1; i <= n; i++) insert(1, ef(a[i]), i);
  for (int i = 1; i <= n; i++)
    if (a[i] == 0 && b[i] == 0) {
      q.push(i);
      vis[i] = 1;
    }
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    find(1, 1, ef(c[x]), x);
  }
  if (vis[n]) {
    vector<int> ans;
    while (n) {
      ans.push_back(n);
      n = from[n];
    }
    reverse(ans.begin(), ans.end());
    printf("%d\n", (int)ans.size());
    for (int i : ans) printf("%d ", i);
    puts("");
  } else
    puts("-1");
  return 0;
}
