#include using namespace std; int main() { int H,W,N; cin >> H >> W >> N; vector>tmp(100000); vector>dist(100000); vectorres(100000); map,int>ans; for(int i = 0; i < N; i++) { int x,y; cin >> x >> y; x--; y--; ans[{x,y}] = i+1; dist[y].push_back(x); res[x]++; tmp[x][y] = 1; } for(int i = 0; i < 100000; i++) { if(dist[i].size() == 0) { continue; } bitset<100000>flag; int sum = 0; for(int j = 0; j < dist[i].size(); j++) { tmp[dist[i][j]][i] = 0; flag |= tmp[dist[i][j]]; sum += res[dist[i][j]]; if(flag.count() != sum) { flag = tmp[dist[i][j]]; sum = res[dist[i][j]]; for(int k = j-1; k >= 0; k--) { flag |= tmp[dist[i][j]]; sum += res[dist[i][j]]; if(flag.count() != sum) { flag = tmp[dist[i][j]]|tmp[dist[i][k]]; for(int l = 0; l < 100000; l++) { if(flag.test(l)) { int x1 = dist[i][j],x2 = dist[i][k]; int y1 = j,y2 = l; cout << 4 << endl; cout << ans[{x1,y1}] << " " << ans[{x2,y1}] << " " << ans[{x2,y2}] << " " << ans[{x1,y2}] << endl; return 0; } } } } } tmp[dist[i][j]][i] = 1; } } cout << -1 << endl; }