Language: C++

include <iostream>
using namespace std;

int F[101][102];

void DFS(int Y, int X, int c) {
        //cout << Y << " " << X << endl;
        if (F[Y][X] != c || F[Y][X] == 0)
                return;
        F[Y][X] = 10;
        DFS(Y - 1, X, c);//???
                                                 //DFS(Y - 1, X+1, A_ito);//??????
        DFS(Y, X + 1, c);//???
                                                 //DFS(Y + 1, X+1, A_ito);//??????
        DFS(Y + 1, X, c);//???
                                                 //DFS(Y + 1, X-1, A_ito);//??????
        DFS(Y, X - 1, c);//???
                                                 //DFS(Y - 1, X-1, A_ito);//??????
}


int main()
{
        int xs, ys, xg, yg, n;
        int c, d, x, y;
        int W = 0, H = 0;

        while (!(W == H == 0)) {
                cin >> W >> H;
                cin >> xs >> ys >> xg >> yg >> n;
                for (int i = 1;i <= n;i++) {
                        cin >> c >> d >> x >> y;
                        if (d == 0) {
                                F[x][y] = c;
                                F[x][y + 1] = c;
                                F[x + 1][y] = c;
                                F[x + 1][y + 1] = c;
                                F[x + 2][y] = c;
                                F[x + 2][y + 1] = c;
                                F[x + 3][y] = c;
                                F[x + 3][y + 1] = c;
                        }
                        if (d == 1) {
                                F[x][y] = c;
                                F[x + 1][y] = c;
                                F[x][y + 1] = c;
                                F[x + 1][y + 1] = c;
                                F[x][y + 2] = c;
                                F[x + 1][y + 2] = c;
                                F[x][y + 3] = c;
                                F[x + 1][y + 3] = c;
                        }
                }
                DFS(ys, xs, F[ys][xs]);

                if (F[yg][xg] == 10) {
                        cout << "OK" << endl;
                }
                else { cout << "NG"<<endl; }
                for (int i = 0;i < H;i++) {
                        for (int j = 0;j < W;j++) {
                                F[i][j] = 0;
                        }
                }
        }

        return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:29:17: error: 'cin' was not declared in this scope
   29 |                 cin >> W >> H;
      |                 ^~~
a.cc:57:25: error: 'cout' was not declared in this scope
   57 |                         cout << "OK" << endl;
      |                         ^~~~
a.cc:57:41: error: 'endl' was not declared in this scope
   57 |                         cout << "OK" << endl;
      |                                         ^~~~
a.cc:59:24: error: 'cout' was not declared in this scope
   59 |                 else { cout << "NG"<<endl; }
      |                        ^~~~
a.cc:59:38: error: 'endl' was not declared in this scope
   59 |                 else { cout << "NG"<<endl; }
      |                                      ^~~~