#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1000000001;
const long long int LLINF = 1000000000000000001LL;
class ITree {
 private:
  vector<vector<pair<int, int> > > L;
  vector<pair<int, int> > T;
  int p;

 public:
  ITree(int n, vector<vector<int> > &pts) {
    p = 1;
    while (p < n) p *= 2;
    L.resize(n);
    for (int i = (0); i <= (n - 1); ++i)
      for (int j = (0); j <= ((int)(pts[i]).size() - 1); ++j)
        L[i].push_back({pts[i][j], i});
    T.resize(2 * p - 1, {-INF, -1});
    for (int i = (0); i <= (n - 1); ++i) {
      sort(L[i].begin(), L[i].end());
      if (!L[i].empty()) T[i + p - 1] = L[i].back();
    }
    for (int i = (p - 2); i >= (0); --i) T[i] = max(T[2 * i + 1], T[2 * i + 2]);
  }
  void Remove(int l) {
    L[l].pop_back();
    T[l + p - 1] = (L[l].empty() ? make_pair(-INF, -1) : L[l].back());
    l += p - 1;
    while (l > 0) {
      l = ((l - 1) / 2);
      T[l] = max(T[2 * l + 1], T[2 * l + 2]);
    }
  }
  pair<int, int> Query(int l, int r) {
    l += p - 1;
    r += p - 1;
    auto ans = T[l];
    if (l < r) ans = max(ans, T[r]);
    while (((l - 1) / 2) != ((r - 1) / 2)) {
      if (l % 2 == 1) ans = max(ans, T[l + 1]);
      if (r % 2 == 0) ans = max(ans, T[r - 1]);
      l = ((l - 1) / 2);
      r = ((r - 1) / 2);
    }
    return ans;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  map<pair<int, int>, vector<pair<int, int> > > G;
  map<pair<int, int>, vector<pair<pair<int, int>, int> > > func;
  map<pair<int, int>, pair<int, int> > edge;
  set<pair<int, int> > reached;
  set<pair<int, pair<int, int> > > S;
  map<pair<int, int>, int> dist;
  vector<int> val;
  vector<pair<int, int> > T;
  pair<int, int> target;
  for (int i = (0); i <= (n - 1); ++i) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    val.push_back(a);
    val.push_back(b);
    val.push_back(c);
    val.push_back(d);
    T.push_back({a, b});
    T.push_back({c, d});
    dist[{a, b}] = INF;
    dist[{c, d}] = INF;
    G[{c, d}].push_back({a, b});
    func[{a, b}].push_back({{c, d}, i + 1});
    if (i == n - 1) target = {a, b};
  }
  sort(val.begin(), val.end());
  val.resize(unique(val.begin(), val.end()) - val.begin());
  int v = (int)(val).size();
  vector<vector<int> > pts(v);
  for (auto &x : T)
    pts[lower_bound(val.begin(), val.end(), x.first) - val.begin()].push_back(
        x.second);
  ITree tree(v, pts);
  S.insert({0, target});
  dist[target] = 0;
  while (!S.empty()) {
    auto elem = *S.begin();
    S.erase(S.begin());
    int dst = elem.first;
    pair<int, int> q = elem.second;
    if (reached.find(q) != reached.end()) continue;
    reached.insert(q);
    for (auto &x : G[q])
      if (reached.find(x) == reached.end() && dst + 1 < dist[x]) {
        edge[x] = q;
        dist[x] = dst + 1;
        S.insert({dst + 1, x});
      }
    while (true) {
      int myX = lower_bound(val.begin(), val.end(), q.first) - val.begin();
      pair<int, int> query = tree.Query(myX, v - 1);
      if (query.first >= q.second) {
        int goX = val[query.second], goY = query.first;
        pair<int, int> pt = {goX, goY};
        if (q == pt || reached.find(pt) == reached.end()) {
          if (q != pt && dst < dist[pt]) {
            edge[pt] = q;
            dist[pt] = dst;
            S.insert({dst, pt});
          }
          tree.Remove(query.second);
        }
      } else
        break;
    }
  }
  if (reached.find({0, 0}) != reached.end()) {
    pair<int, int> x = {0, 0};
    vector<int> ans;
    pair<int, int> prev;
    while (x != target) {
      prev = x;
      x = edge[x];
      int daFunc = -1;
      for (auto &fc : func[prev])
        if (fc.first == x) daFunc = fc.second;
      if (daFunc != -1) ans.push_back(daFunc);
    }
    ans.push_back(n);
    vector<int> good;
    for (int i = (0); i <= ((int)(ans).size() - 1); ++i)
      if (ans[i]) good.push_back(ans[i]);
    cout << (int)(good).size() << '\n';
    for (int i = (0); i <= ((int)(good).size() - 1); ++i)
      cout << good[i] << ' ';
    return 0;
  }
  cout << -1;
  return 0;
}
