#include<iostream>
using namespace std;
union IP //创建共用体
{unsigned char a[4];unsigned int ip;
};
IP getIP() //获取ip函数
{int a, b, c, d;scanf_s("%d.%d.%d.%d", &a, &b, &c, &d);IP address;address.a[3] = a; address.a[2] = b;address.a[1] = c; address.a[0] = d;return address;
}
int main()
{IP host, mask, otherip;host = getIP(); //获取主机ipmask = getIP(); //获取掩码ipint n;cin >> n; //有n个其他网for (int i = 0; i < n; i++){otherip = getIP(); //获取其他网的ip//判断主机和其他网是否是内网if ((host.ip & mask.ip) == (otherip.ip & mask.ip))cout << "inner" << endl;elsecout << "outer" << endl;}return 0;
}