#include using namespace std; int N, M, K; vector > solution; int main() { cin >> K >> N >> M; if(N != K && M != K) { cout << -1; return 0; } for(int i = 1; i < N; i ++) { for(int j = i + 1; j <= N; j ++) { solution.push_back(make_pair(i, j)); } } int a = 1; for(int i = 1; i <= M - 1; i ++) { int nr = 0; for(int it = 0; it < solution.size(); it ++) { if( solution[it].first == a && solution[it].second == a + 1) { swap(solution[it], solution[solution.size() - 1]); solution.pop_back(); //solution.erase(solution.begin() + nr, solution.begin() + nr); } nr ++; } a ++; } if(solution.size() < N - 1) { cout << -1; return 0; } cout << solution.size() << '\n'; for(auto it = solution.begin(); it != solution.end(); it ++) { cout << it -> first << " " << it -> second << '\n'; } return 0; }