#include <bits/stdc++.h>
using namespace std;
struct str {
  int a, b, c, d;
};
struct str1 {
  int val, poz;
  bool operator<(const str1 &aux) const { return val > aux.val; }
};
str v[100010];
vector<int> mp;
vector<str1> v1[200010];
pair<int, int> arb[800010];
int sol, pozz, tata[100010], rez[100010], q[100010];
int norm(int val) {
  return lower_bound(mp.begin(), mp.end(), val) - mp.begin();
}
void arbint_update(int nod, int st, int dr, int poz, int val) {
  if (st == dr)
    arb[nod] = {val, poz};
  else {
    int mid = (st + dr) / 2;
    if (poz <= mid)
      arbint_update(nod * 2, st, mid, poz, val);
    else
      arbint_update(nod * 2 + 1, mid + 1, dr, poz, val);
    if (arb[nod * 2].first < arb[nod * 2 + 1].first)
      arb[nod].second = arb[nod * 2].second;
    else
      arb[nod].second = arb[nod * 2 + 1].second;
    arb[nod].first = min(arb[nod * 2].first, arb[nod * 2 + 1].first);
  }
}
void arbint_query(int nod, int st, int dr, int left, int right) {
  if (left <= st && dr <= right) {
    if (arb[nod].first < sol) {
      sol = arb[nod].first;
      pozz = arb[nod].second;
    }
    return;
  }
  int mid = (st + dr) / 2;
  if (left <= mid) arbint_query(nod * 2, st, mid, left, right);
  if (mid < right) arbint_query(nod * 2 + 1, mid + 1, dr, left, right);
}
int main() {
  int n, l = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d%d", &v[i].a, &v[i].b, &v[i].c, &v[i].d);
    mp.push_back(v[i].a);
    mp.push_back(v[i].c);
  }
  sort(mp.begin(), mp.end());
  mp.resize(unique(mp.begin(), mp.end()) - mp.begin());
  for (int i = 1; i <= n; i++) {
    if (v[i].a == 0 && v[i].b == 0) {
      q[++l] = i;
      continue;
    }
    int poz1 = norm(v[i].a);
    v1[poz1].push_back({v[i].b, i});
  }
  int m = mp.size() - 1;
  for (int i = 0; i < mp.size(); i++)
    if (v1[i].size() == 0)
      arbint_update(1, 0, m, i, 2e9);
    else {
      sort(v1[i].begin(), v1[i].end());
      arbint_update(1, 0, m, i, v1[i].back().val);
    }
  for (int i = 1; i <= l; i++) {
    if (q[i] == n) {
      int cnt = 0;
      for (int j = n; j > 0; j = tata[j]) rez[++cnt] = j;
      printf("%d\n", cnt);
      for (int j = cnt; j > 0; j--) printf("%d ", rez[j]);
      return 0;
    }
    while (1) {
      sol = 2e9;
      arbint_query(1, 0, m, 0, norm(v[q[i]].c));
      if (sol > v[q[i]].d) break;
      int poz = v1[pozz].back().poz;
      tata[poz] = q[i];
      q[++l] = poz;
      v1[pozz].pop_back();
      if (v1[pozz].size() == 0)
        arbint_update(1, 0, m, pozz, 2e9);
      else
        arbint_update(1, 0, m, pozz, v1[pozz].back().val);
    }
  }
  printf("-1");
  return 0;
}
