#include <bits/stdc++.h>
using namespace std;
const int INF = 2 * int(1e9);
const long long INFll = 1ll * INF * INF;
const int MOD = 1000000007;
struct unit {
  int a, b, c, d;
  unit() {}
};
int sz;
vector<pair<int, int> > t;
vector<unit> a;
pair<int, int> fmin(int v, int l, int r, int l1, int r1) {
  if (l > r1 || r < l1) return make_pair(INF, -1);
  if (l >= l1 && r <= r1) return t[v];
  return min(fmin(v * 2, l, (l + r) / 2, l1, r1),
             fmin(v * 2 + 1, (l + r) / 2 + 1, r, l1, r1));
}
bool comp(int x, int y) { return a[x].b < a[y].b; }
void modify(int v, pair<int, int> a) {
  t[v] = a;
  v /= 2;
  while (v) {
    t[v] = min(t[v * 2], t[v * 2 + 1]);
    v /= 2;
  }
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  a.resize(n);
  map<int, int> w;
  for (int i = 0; i < n; ++i) {
    unit x;
    cin >> x.a >> x.b >> x.c >> x.d;
    a[i] = x;
    w[x.a]++;
    w[x.b]++;
    w[x.c]++;
    w[x.d]++;
  }
  int k = 0;
  for (typeof(w.begin()) i = w.begin(); i != w.end(); ++i) i->second = k++;
  vector<vector<int> > nums(k);
  queue<int> q;
  vector<int> d(n, INF);
  vector<int> nice(n);
  for (int i = 0; i < n; ++i) {
    if (!a[i].a && !a[i].b) nice[i] = 1;
    a[i].a = w[a[i].a];
    a[i].b = w[a[i].b];
    a[i].c = w[a[i].c];
    a[i].d = w[a[i].d];
  }
  sz = 1;
  while (sz < k) sz *= 2;
  t.assign(sz * 2, make_pair(INF, -1));
  for (int i = 0; i < n; ++i) {
    if (nice[i]) {
      d[i] = 1;
      q.push(i);
    } else
      nums[a[i].a].push_back(i);
  }
  vector<int> indices(k);
  for (int i = 0; i < k; ++i) {
    sort(nums[i].begin(), nums[i].end(), comp);
    if (!nums[i].empty())
      modify(sz + i, make_pair(a[nums[i][0]].b, nums[i][0]));
  }
  vector<int> p(n, -1);
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    while (1) {
      pair<int, int> x = fmin(1, 0, sz - 1, 0, a[v].c);
      if (x.first > a[v].d)
        break;
      else {
        q.push(x.second);
        d[x.second] = d[v] + 1;
        p[x.second] = v;
        indices[a[x.second].a]++;
        if (indices[a[x.second].a] == nums[a[x.second].a].size())
          modify(a[x.second].a + sz, make_pair(INF, -1));
        else
          modify(sz + a[nums[a[x.second].a][indices[a[x.second].a]]].a,
                 make_pair(a[nums[a[x.second].a][indices[a[x.second].a]]].b,
                           nums[a[x.second].a][indices[a[x.second].a]]));
      }
    }
  }
  if (d[n - 1] == INF)
    cout << -1;
  else {
    int cur = n - 1;
    vector<int> ans;
    while (cur != -1) {
      ans.push_back(cur);
      cur = p[cur];
    }
    reverse(ans.begin(), ans.end());
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); ++i) cout << ans[i] + 1 << " ";
  }
  if (0) cerr << "\nTIME = " << clock() << "\n";
  return 0;
}
