#include <bits/stdc++.h>   using namespace std;   int n;   int s[4040][4040];   bool u[4040][4040], r[4040][4040];   int su[4040][4040], sr[4040][4040];   bool b[4040][4040];   int get(int x1, int y1, int x2, int y2) {     return s[x2][y2] + s[x1 - 1][y1 - 1] - s[x1 - 1][y2] - s[x2][y1 - 1];   }   struct Point {     int x, y;     Point() {}     Point(int _x, int _y) {       x = _x;       y = _y;     }     bool operator<(const Point &b) const {       if (x == b.x) return y < b.y;       return x < b.x;     }     bool operator==(const Point &b) const { return x == b.x && y == b.y; }   };   Point p[1010101];   int m;   int X1[1010101], X2[1010101], Y1[1010101], Y2[1010101];   int out[1010101];   int ans = 0;   int main() {     std::ios::sync_with_stdio(false);     cin >> n;     for (int i = 1; i <= n; i++) {       int x1, x2, y1, y2;       cin >> x1 >> y1 >> x2 >> y2;       X1[i] = x1;       Y1[i] = y1;       X2[i] = x2;       Y2[i] = y2;       for (int x = x1 + 1; x <= x2; x++)         for (int y = y1 + 1; y <= y2; y++) b[x][y] = true;       for (int x = x1; x < x2; x++) r[x][y1] = r[x][y2] = true;       for (int y = y1; y < y2; y++) u[x1][y] = u[x2][y] = true;       p[++m] = Point(x1, y1);       p[++m] = Point(x1, y2);     }     sort(p + 1, p + 1 + m);     m = unique(p + 1, p + 1 + m) - p - 1;     s[0][0] = b[0][0];     su[0][0] = u[0][0];     sr[0][0] = r[0][0];     for (int j = 1; j <= 3005; j++) {       s[0][j] = s[0][j - 1] + b[0][j];       su[0][j] = su[0][j - 1] + u[0][j];       sr[0][j] = r[0][j];     }     for (int i = 1; i <= 3005; i++) {       s[i][0] = s[i - 1][0] + b[i][0];       sr[i][0] = sr[i - 1][0] + r[i][0];       su[i][0] = u[i][0];     }     for (int i = 1; i <= 3005; i++)       for (int j = 1; j <= 3005; j++) {         s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + b[i][j];         su[i][j] = su[i][j - 1] + u[i][j];         sr[i][j] = sr[i - 1][j] + r[i][j];       }     for (int i = 1; i <= m; i++) {       int x = p[i].x, y = p[i].y;       for (int j = i + 1; j <= m && p[j].x == x; j++) {         int yy = p[j].y, len = p[j].y - y + 1;         if (x + len - 1 > 3005) continue;         int cnt = get(x + 1, y + 1, x + len - 1, y + len - 1);         if (cnt != ((len - 1) * (len - 1))) continue;         if (x == 0) {           if (sr[x + len - 2][y] != len - 1) continue;           if (sr[x + len - 2][yy] != len - 1) continue;         } else {           if (sr[x + len - 2][y] - sr[x - 1][y] != len - 1) continue;           if (sr[x + len - 2][yy] - sr[x - 1][yy] != len - 1) continue;         }         if (y == 0) {           if (su[x][yy - 1] != len - 1) continue;           if (su[x + len - 1][yy - 1] != len - 1) continue;         } else {           if (su[x][yy - 1] - su[x][y - 1] != len - 1) continue;           if (su[x + len - 1][yy - 1] - su[x + len - 1][y - 1] != len - 1)             continue;         }         for (int k = 1; k <= n; k++)           if (X1[k] >= x && X1[k] <= x + len - 1 && X2[k] >= x &&               X2[k] <= x + len - 1 && Y1[k] >= y && Y1[k] <= y + len - 1 &&               Y2[k] >= y && Y2[k] <= y + len - 1) {             out[++ans] = k;           }         cout <<  YES               <<     << ans << endl;         for (int k = 1; k <= ans; k++) cout << out[k] <<    ;         return 0;       }     }     cout <<  NO  << endl;     return 0;   }