#pragma GCC optimize(2);#include <bits/stdc++.h>using namespace std;int g[800][800];int n;void inline dfs(int n, int x, int y){ if(n == 1){ g[x]...