/* -------------- | / | | / | | / | * |/ | | ------ * | | | | / \ | | |\ | | | |\ | \ | | | \ | | | | \ | \ | | | \ | | \ / \ | V | | \ \__/| ----- \ | */ #include using namespace std; #define debug(x) cerr << "\e[1;31m" << #x << " = " << (x) << "\e[0m\n" #define print(x) emilia_mata_tenshi(#x, begin(x), end(x)) template void emilia_mata_tenshi(const char *s, T l, T r) { cerr << "\e[1;33m" << s << " = ["; while(l != r) { cerr << *l; cerr << (++l == r ? ']' : ','); } cerr << "\e[0m\n"; } #define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL); using ll = int64_t; using ull = uint64_t; using ld = long double; using uint = uint32_t; const double EPS = 1e-8; const int INF = 0x3F3F3F3F; const ll LINF = 4611686018427387903; const int MOD = 1e9+7; /*--------------------------------------------------------------------------------------*/ signed main() { EmiliaMyWife int h, w, n; cin >> h >> w >> n; vector>> arr(w + 1); for(int i = 0; i < n; i++) { int x, y; cin >> y >> x; arr[x].push_back({y, i + 1}); } vector> has(h + 1, {-1, -1}); for(const auto &a : arr) { if(a.size() <= 1) continue; for(int i = 0; i < a.size(); i++) { if(~has[a[i].first].first) { cout << "4\n"; cout << has[a[i].first].second << ' ' << has[a[i].first].first << ' '; cout << a[i].second << ' ' << a[(i + 1) % a.size()].second << '\n'; return 0; } } for(int i = 0; i < a.size(); i++) { has[a[i].first] = {a[i].second, a[(i + 1) % a.size()].second}; } } cout << "-1\n"; }