#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int kMaxN = 2e5 + 17;
constexpr int inf = 1e9 + 7;
int minimum[4 * kMaxN];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> xs = {0, inf};
  vector<array<int, 4>> points(n + 1);
  points[0] = {inf, inf, 0, 0};
  for (int i = 0; i < n; ++i) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    xs.emplace_back(a);
    xs.emplace_back(c);
    points[i + 1] = {a, b, c, d};
  }
  sort(xs.begin(), xs.end());
  xs.resize(unique(xs.begin(), xs.end()) - xs.begin());
  unordered_map<int, int> reorder;
  for (int i = 0; i < xs.size(); ++i) {
    reorder[xs[i]] = i;
  }
  vector<vector<int>> leaves(xs.size());
  for (int i = 0; i < points.size(); ++i) {
    auto& p = points[i];
    p[0] = reorder[p[0]];
    p[2] = reorder[p[2]];
    leaves[p[0]].emplace_back(i);
  }
  int sz = 1;
  while (sz < xs.size()) {
    sz *= 2;
  }
  for (auto& leaf : leaves) {
    sort(leaf.begin(), leaf.end(),
         [&](int i1, int i2) { return points[i1][1] > points[i2][1]; });
  }
  for (int i = 0; i < leaves.size(); ++i) {
    if (!leaves[i].empty()) {
      minimum[sz + i] = leaves[i].back();
    }
  }
  auto better = [&](int l, int r) {
    if (points[l][1] < points[r][1]) {
      return l;
    }
    return r;
  };
  for (int i = sz - 1; i > 0; --i) {
    int l = minimum[2 * i], r = minimum[2 * i + 1];
    minimum[i] = better(l, r);
  }
  function<int(int, int, int, int, int)> get_min = [&](int l, int r, int L,
                                                       int R, int idx) {
    if (l == L && r == R) {
      return minimum[idx];
    }
    int M = (L + R) / 2;
    if (r <= M) {
      return get_min(l, r, L, M, 2 * idx);
    } else if (l > M) {
      return get_min(l, r, M + 1, R, 2 * idx + 1);
    } else {
      return better(get_min(l, M, L, M, 2 * idx),
                    get_min(M + 1, r, M + 1, R, 2 * idx + 1));
    }
  };
  vector<int> dist(n + 1, -1);
  vector<int> parent(n + 1, -1);
  queue<int> q;
  q.emplace(0);
  dist[0] = 0;
  while (!q.empty() && dist[n] == -1) {
    int cur = q.front();
    q.pop();
    int x = points[cur][2], y = points[cur][3];
    int idx = get_min(0, x, 0, sz - 1, 1);
    while (points[idx][1] <= y) {
      if (dist[idx] == -1) {
        dist[idx] = dist[cur] + 1;
        q.emplace(idx);
        parent[idx] = cur;
      } else {
        assert(false);
      }
      int cx = points[idx][0];
      leaves[cx].pop_back();
      minimum[cx + sz] = leaves[cx].empty() ? 0 : leaves[cx].back();
      cx += sz;
      do {
        cx /= 2;
        int l = minimum[2 * cx], r = minimum[2 * cx + 1];
        minimum[cx] = better(l, r);
      } while (cx != 1);
      idx = get_min(0, x, 0, sz - 1, 1);
    }
  }
  cout << dist[n] << '\n';
  if (dist[n] != -1) {
    vector<int> nodes;
    int cur = n;
    do {
      nodes.emplace_back(cur);
      cur = parent[cur];
    } while (parent[cur] != -1);
    for (int i = nodes.size() - 1; i >= 0; --i) {
      cout << nodes[i] << ' ';
    }
    cout << '\n';
  }
  return 0;
}
