Language: C++

#include <iostream>
#include <string>
using namespace std;
int main(){
int a;
int b;
int c;
int h;
while(cin >>a>>b>>c){
if(a==0&&b==0&&c==0){break;}
cin >>n;
int d[n];
int e[n];
int f[n];
int g[n];
int i[n];
h=0;
while(h<n){
cin >>d[h];
cin >>e[h];
cin >>f[h];
cin >>g[h];
i[h]==2;
h=h+1;}
h=0;
while(h<n){
if(g[h]==1){i[d[h]]=1; i[e[h]]=1; i[f[h]]=1;}
h=h+1;}
h=0;
while(h<n){
if(i[d[h]]==1&&i[e[h]]==1&&g[h]==0){i[f[h]]==0;}
if(i[f[h]]==1&&i[e[h]]==1&&g[h]==0){i[d[h]]==0;}
if(i[d[h]]==1&&i[f[h]]==1&&g[h]==0){i[e[h]]==0;}
h=h+1;}
h=0;
while(h<n){
cout <<i[h]<<endl;
h=h+1;}
}}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:7: error: 'n' was not declared in this scope
   11 | cin >>n;
      |       ^
a.cc:19:7: error: 'd' was not declared in this scope
   19 | cin >>d[h];
      |       ^
a.cc:20:7: error: 'e' was not declared in this scope
   20 | cin >>e[h];
      |       ^
a.cc:21:7: error: 'f' was not declared in this scope
   21 | cin >>f[h];
      |       ^
a.cc:22:7: error: 'g' was not declared in this scope
   22 | cin >>g[h];
      |       ^
a.cc:23:1: error: 'i' was not declared in this scope
   23 | i[h]==2;
      | ^
a.cc:27:4: error: 'g' was not declared in this scope
   27 | if(g[h]==1){i[d[h]]=1; i[e[h]]=1; i[f[h]]=1;}
      |    ^
a.cc:27:13: error: 'i' was not declared in this scope
   27 | if(g[h]==1){i[d[h]]=1; i[e[h]]=1; i[f[h]]=1;}
      |             ^
a.cc:27:15: error: 'd' was not declared in this scope
   27 | if(g[h]==1){i[d[h]]=1; i[e[h]]=1; i[f[h]]=1;}
      |               ^
a.cc:27:26: error: 'e' was not declared in this scope
   27 | if(g[h]==1){i[d[h]]=1; i[e[h]]=1; i[f[h]]=1;}
      |                          ^
a.cc:27:37: error: 'f' was not declared in this scope
   27 | if(g[h]==1){i[d[h]]=1; i[e[h]]=1; i[f[h]]=1;}
      |                                     ^
a.cc:31:4: error: 'i' was not declared in this scope
   31 | if(i[d[h]]==1&&i[e[h]]==1&&g[h]==0){i[f[h]]==0;}
      |    ^
a.cc:31:6: error: 'd' was not declared in this scope
   31 | if(i[d[h]]==1&&i[e[h]]==1&&g[h]==0){i[f[h]]==0;}
      |      ^
a.cc:31:18: error: 'e' was not declared in this scope
   31 | if(i[d[h]]==1&&i[e[h]]==1&&g[h]==0){i[f[h]]==0;}
      |                  ^
a.cc:31:28: error: 'g' was not declared in this scope
   31 | if(i[d[h]]==1&&i[e[h]]==1&&g[h]==0){i[f[h]]==0;}
      |                            ^
a.cc:31:39: error: 'f' was not declared in this scope
   31 | if(i[d[h]]==1&&i[e[h]]==1&&g[h]==0){i[f[h]]==0;}
      |                                       ^
a.cc:32:4: error: 'i' was not declared in this scope
   32 | if(i[f[h]]==1&&i[e[h]]==1&&g[h]==0){i[d[h]]==0;}
      |    ^
a.cc:32:6: error: 'f' was not declared in this scope
   32 | if(i[f[h]]==1&&i[e[h]]==1&&g[h]==0){i[d[h]]==0;}
      |      ^
a.cc:32:18: error: 'e' was not declared in this scope
   32 | if(i[f[h]]==1&&i[e[h]]==1&&g[h]==0){i[d[h]]==0;}
      |                  ^
a.cc:32:28: error: 'g' was not declared in this scope
   32 | if(i[f[h]]==1&&i[e[h]]==1&&g[h]==0){i[d[h]]==0;}
      |                            ^
a.cc:32:39: error: 'd' was not declared in this scope
   32 | if(i[f[h]]==1&&i[e[h]]==1&&g[h]==0){i[d[h]]==0;}
      |                                       ^
a.cc:33:4: error: 'i' was not declared in this scope
   33 | if(i[d[h]]==1&&i[f[h]]==1&&g[h]==0){i[e[h]]==0;}
      |    ^
a.cc:33:6: error: 'd' was not declared in this scope
   33 | if(i[d[h]]==1&&i[f[h]]==1&&g[h]==0){i[e[h]]==0;}
      |      ^
a.cc:33:18: error: 'f' was not declared in this scope
   33 | if(i[d[h]]==1&&i[f[h]]==1&&g[h]==0){i[e[h]]==0;}
      |                  ^
a.cc:33:28: error: 'g' was not declared in this scope
   33 | if(i[d[h]]==1&&i[f[h]]==1&&g[h]==0){i[e[h]]==0;}
      |                            ^
a.cc:33:39: error: 'e' was not declared in this scope
   33 | if(i[d[h]]==1&&i[f[h]]==1&&g[h]==0){i[e[h]]==0;}
      |                                       ^
a.cc:37:8: error: 'i' was not declared in this scope
   37 | cout <<i[h]<<endl;
      |        ^