#include <bits/stdc++.h>
using namespace std;
template <class T>
void dbg(const char* xn, T x) {
  if (0) cout << xn << ": " << x << "\n";
}
template <class T, class... TA>
void dbg(const char* xn, T x, TA... t) {
  while (*xn != ',')
    if (0) cout << *xn++;
  if (0) cout << ": " << x << ",";
  dbg(xn + 1, t...);
}
template <class T>
inline bool upd_max(T& x, T y) {
  return y > x ? x = y, true : false;
}
template <class T>
inline bool upd_min(T& x, T y) {
  return y < x ? x = y, true : false;
}
const int N = 400007;
const int M = (1 << 19);
long long n, A[N], B[N], C[N], D[N], dis[N], cur[N], from[N];
pair<long long, long long> w[2 * M];
vector<long long> X[N], rst, values;
void Insert(long long x, long long val) {
  x += M;
  w[x] = make_pair(val, x - M);
  x /= 2;
  while (x) {
    w[x] = min(w[2 * x], w[2 * x + 1]);
    x /= 2;
  }
}
pair<long long, long long> Query(long long a, long long b) {
  a += M;
  b += M;
  pair<long long, long long> res = w[a];
  if (a != b) res = min(res, w[b]);
  while (a / 2 != b / 2) {
    if (!(a & 1)) res = min(res, w[a + 1]);
    if (b & 1) res = min(res, w[b - 1]);
    a /= 2;
    b /= 2;
  }
  return res;
}
void BuildTree() {
  for (long long i = 0; i < 2 * M; ++i)
    w[i] = make_pair(1000000000000000007LL, 1000000000000000007LL);
  for (long long i = 0; i <= 2 * n; ++i) {
    if (!X[i].empty()) Insert(i, B[X[i][0]]);
  }
}
void compressX() {
  values.push_back(0);
  for (long long i = 1; i <= (n); ++i)
    values.push_back(A[i]), values.push_back(C[i]);
  sort((values).begin(), (values).end());
  values.erase(unique((values).begin(), (values).end()), values.end());
  for (long long i = 1; i <= n; ++i) {
    A[i] = lower_bound((values).begin(), (values).end(), A[i]) - values.begin();
    C[i] = lower_bound((values).begin(), (values).end(), C[i]) - values.begin();
  }
  for (long long i = 1; i <= n; ++i) X[A[i]].push_back(i);
  for (long long i = 0; i <= 2 * n; ++i) {
    sort((X[i]).begin(), (X[i]).end(),
         [&](long long a, long long b) { return B[a] < B[b]; });
  }
}
void BFS() {
  queue<long long> Q;
  for (long long i = 0; i < (N); ++i) dis[i] = 1000000000000000007LL;
  dis[0] = 0;
  Q.push(0);
  while (!Q.empty()) {
    long long v = Q.front();
    Q.pop();
    pair<long long, long long> ans = Query(0, C[v]);
    long long ind = ans.second, Y = ans.first;
    while (Y <= D[v]) {
      long long u = X[ind][cur[ind]];
      from[u] = v;
      dis[u] = dis[v] + 1;
      Q.push(u);
      if (++cur[ind] == ((long long)(X[ind]).size()))
        Insert(ind, 1000000000000000007LL);
      else
        Insert(ind, B[X[ind][cur[ind]]]);
      ans = Query(0, C[v]);
      ind = ans.second;
      Y = ans.first;
    }
  }
}
void solve() {
  cin >> n;
  for (long long i = 1; i <= (n); ++i) cin >> A[i] >> B[i] >> C[i] >> D[i];
  compressX();
  BuildTree();
  BFS();
  if (dis[n] >= 1000000000000000007LL) cout << "-1", exit(0);
  long long v = n;
  while (v) rst.push_back(v), v = from[v];
  reverse((rst).begin(), (rst).end());
  cout << ((long long)(rst).size()) << '\n';
  for (auto x : rst) cout << x << " ";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout << fixed << setprecision(10);
  solve();
  return 0;
}
