t = int(input())
ans = 'abcdefghijklmnopqrstuvwxyz'
ans_a = dict()
for i in range(t):
    s = str(input())
    if len(s) == 1:
        print(s)
    else:
        for x in range(26):
            ans_a[ans[x]] = 0
        now = s[0]
        for j in range(1, len(s)):
            if s[j] == s[j - 1]:
                now += s[j]
            else:
                if len(now) % 2 != 0:
                    ans_a[s[j - 1]] = 1
                now = s[j]
        if len(now) % 2 == 1:
            ans_a[s[-1]] = 1
        if s[len(s) - 1] != s[len(s) - 2]:
            ans_a[s[len(s) - 1]] = 1
        for x in range(26):
            if ans_a[ans[x]] == 1:
                print(ans[x], end = '')
        print()


t = int(input())
ans = 'abcdefghijklmnopqrstuvyxyz'
ans_a = dict()
for i in range(t):
    s = str(input())
    if len(s) == 1:
        print(s)
    else:
        for x in range(26):
            ans_a[ans[x]] = 0
        now = s[0]
        for j in range(1, len(s)):
            if s[j] == s[j - 1]:
                now += s[j]
            else:
                if len(now) % 2 != 0:
                    ans_a[s[j - 1]] = 1
                now = s[j]
        if len(now) % 2 == 1:
            ans_a[s[-1]] = 1
        if s[len(s) - 1] != s[len(s) - 2]:
            ans_a[s[len(s) - 1]] = 1
        for x in range(26):
            if ans_a[ans[x]] == 1:
                print(ans[x], end = '')
        print()


t = int(input())
ans = 'abcdefghijklmnopqrstuvxyz'
ans_a = dict()
for i in range(t):
    s = str(input())
    if len(s) == 1:
        print(s)
    else:
        for x in range(26):
            ans_a[ans[x]] = 0
        now = s[0]
        for j in range(1, len(s)):
            if s[j] == s[j - 1]:
                now += s[j]
            else:
                if len(now) % 2 != 0:
                    ans_a[s[j - 1]] = 1
                now = s[j]
        if len(now) % 2 == 1:
            ans_a[s[-1]] = 1
        if s[len(s) - 1] != s[len(s) - 2]:
            ans_a[s[len(s) - 1]] = 1
        for x in range(26):
            if ans_a[ans[x]] == 1:
                print(ans[x], end = '')
        print()


q = int(input())
for re in range(q):
	s = input()
	dob = set()
	n = len(s)
	s = '0' + s + '0'
	i = 1
	while i < n + 2:
		pocz = s[i]
		i += 1
		dupa = 1
		while True:
			if i == n + 2:
				break
			if s[i] == pocz:
				dupa += 1
				i += 1
			else:
				break
		if dupa % 2 == 1:
			dob.add(pocz)
	l = []
	for i in dob:
		if i != '0':
			l.append(i)
	l.sort()
	if len(l) == 0:
		print("")
	else:
		for i in range(len(l)):
			if i < len(l) - 1:
				print(l[i], end = "")
			else:
				print(l[i])


q = int(input())
for re in range(q):
	s = input()
	dob = set()
	n = len(s)
	s = '0' + s + '0'
	for i in range(1, n+1):
		if s[i] != s[i-1] and s[i] != s[i+1]:
			dob.add(s[i])
	l = []
	for i in dob:
		if i != '0':
			l.append(i)
	l.sort()
	for i in l:
		print(i, end = "")
	print("")


q = int(input())
for re in range(q):
	s = input()
	dob = set()
	n = len(s)
	s = '0' + s + '0'
	for i in range(1, n+1):
		if s[i] != s[i-1] and s[i] != s[i+1]:
			dob.add(s[i])
	l = []
	for i in dob:
		if i != '0':
			l.append(i)
	l.sort()
	if len(l) == 0:
		print("")
	else:
		for i in range(len(l)):
			if i < len(l) - 1:
				print(l[i], end = "")
			else:
				print(l[i])


#!/usr/bin/env python3
import sys

#lines = stdin.readlines()
def rint():
    return map(int, sys.stdin.readline().split())

def input():
    return sys.stdin.readline().rstrip('\n')

def oint():
    return int(input())

t = oint()
for _ in range(t):
    s = input()
    s = '_' + s + '+'
    ans = set()
    for i in range(1, len(s)-1):
        if s[i] != s[i-1] and s[i] != s[i+1]:
            ans.add(s[i])
    if len(ans):
        ans = list(ans)
        ans.sort()
        print(''.join(ans))
    else:
        print()


#!/usr/bin/env python3
import sys

#lines = stdin.readlines()
def rint():
    return map(int, sys.stdin.readline().split())

def input():
    return sys.stdin.readline().rstrip('\n')

def oint():
    return int(input())

t = oint()
for _ in range(t):
    s = input()
    ans = set()
    cnt = 1
    for i in range(len(s)-1):
        if s[i] == s[i+1]:
            cnt += 1
        else:
            if cnt%2:
                ans.add(s[i])
            cnt = 1

    if cnt%2:
        ans.add(s[-1])

    if len(ans):
        ans = list(ans)
        ans.sort()
        print(''.join(ans))
    else:
        print()


#!/usr/bin/env python3
import sys

#lines = stdin.readlines()
def rint():
    return map(int, sys.stdin.readline().split())

def input():
    return sys.stdin.readline().rstrip('\n')

def oint():
    return int(input())

t = oint()
for _ in range(t):
    s = input()
    s = '_' + s + '+'
    ans = set()
    for i in range(1, len(s)-1):
        if s[i] != s[i-1] and s[i] != s[i+1]:
            ans.add(s[i])
    if len(ans):
        ans = list(ans)
        ans.sort()
        print(''.join(ans))


import sys
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin,stdout
from collections import defaultdict, deque
from math import log2, ceil, floor

inp=lambda : int(input())
sip=lambda : input()
mulip =lambda : map(int,input().split())
lst=lambda : list(map(int,input().split()))
slst=lambda: list(sip())
arr2d= lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x%2!=0, l)))
evens = lambda l: len(list(filter(lambda x: x%2==0, l)))
mod = pow(10,9)+7
#-------------------------------------------------------
sys.stdin = open('input.in','r')
for _ in range(inp()):
    s = list(input())
    x = []
    for i in range(len(s)):
        if i==0 and len(s)>1:
            if s[i]!=s[i+1]:
                x.append(s[i])
        if i==len(s)-1 and len(s)>1:
            if s[i]!=s[i-1]:
                x.append(s[i])
        if i!=0 and i!=len(s)-1 and len(s)>2:
            if s[i]!=s[i-1] and s[i]!=s[i+1]:
                x.append(s[i])
    if len(s)==1:
        x.append(s[0])
    if len(x)==0:
        print("")
    else:
        x = list(set(x))
        x = sorted(x)
        print("".join(x))


import sys
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin,stdout
from collections import defaultdict, deque
from math import log2, ceil, floor

inp=lambda : int(input())
sip=lambda : input()
mulip =lambda : map(int,input().split())
lst=lambda : list(map(int,input().split()))
slst=lambda: list(sip())
arr2d= lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x%2!=0, l)))
evens = lambda l: len(list(filter(lambda x: x%2==0, l)))
mod = pow(10,9)+7
#-------------------------------------------------------
#sys.stdin = open('input.in','r')
for _ in range(inp()):
    s = input()
    d = dict()
    x = []
    for i in range(len(s)):
        if s[i] in d:
            d[s[i]].append(i)
        else:
            d[s[i]] = [i]
    for keys,values in d.items():
        #print(keys)
        #print(values)
        fl = False
        #print(values)
        for j in range(len(values)-1):
            if(values[j] + 1 != values[j+1]):
                fl = True
        if fl or len(values) == 1 or len(values)%2==1:
            x.append(keys)
    if len(x)==0:
        print("")
    else:
        x = sorted(x)
        print("".join(x))


import sys
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin,stdout
from collections import defaultdict, deque
from math import log2, ceil, floor

inp=lambda : int(input())
sip=lambda : input()
mulip =lambda : map(int,input().split())
lst=lambda : list(map(int,input().split()))
slst=lambda: list(sip())
arr2d= lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x%2!=0, l)))
evens = lambda l: len(list(filter(lambda x: x%2==0, l)))
mod = pow(10,9)+7
#-------------------------------------------------------
#sys.stdin = open('input.in','r')
for _ in range(inp()):
	s = list(input())
	x = []
	if len(s)==1:
		print(s[0])
	else:
		cnt = 1
		tmp = s[0]
		for i in range(1,len(s)):
			#print(tmp)
			if s[i]==tmp:
				cnt+=1
			else:
				if cnt%2==1:
					x.append(tmp)
					tmp = s[i]
					cnt = 1
		if cnt%2==1:
			x.append(tmp)
		if len(x)==0:
			print("")
		else:
			print("".join(sorted(list(set(x)))))


import sys
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin,stdout
from collections import defaultdict, deque
from math import log2, ceil, floor

inp=lambda : int(input())
sip=lambda : input()
mulip =lambda : map(int,input().split())
lst=lambda : list(map(int,input().split()))
slst=lambda: list(sip())
arr2d= lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x%2!=0, l)))
evens = lambda l: len(list(filter(lambda x: x%2==0, l)))
mod = pow(10,9)+7
#-------------------------------------------------------
#sys.stdin = open('input.in','r')
for _ in range(inp()):
    s = input()
    d = dict()
    x = []
    for i in range(len(s)):
        if s[i] in d:
            d[s[i]].append(i)
        else:
            d[s[i]] = [i]
    for keys,values in d.items():
        #print(keys)
        #print(values)
        fl = False
        #print(values)
        for j in range(len(values)-1):
            if(values[j] + 1 != values[j+1]):
                fl = True
        if fl or len(values) == 1:
            x.append(keys)
    if len(x)==0:
        print("")
    else:
        x = sorted(x)
        print("".join(x))


import sys
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin,stdout
from collections import defaultdict, deque
from math import log2, ceil, floor

inp=lambda : int(input())
sip=lambda : input()
mulip =lambda : map(int,input().split())
lst=lambda : list(map(int,input().split()))
slst=lambda: list(sip())
arr2d= lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x%2!=0, l)))
evens = lambda l: len(list(filter(lambda x: x%2==0, l)))
mod = pow(10,9)+7
#-------------------------------------------------------
sys.stdin = open('input.in','r')
for _ in range(inp()):
	s = list(input())
	x = []
	if len(s)==1:
		print(s[0])
	elif len(s)==2:
		if s[0]!=s[1]:
			print("".join(sorted(s)))
		else:
			print("")
	else:
		for i in range(len(s)):
			if i==0 and s[i]!=s[i+1]:
				x.append(s[i])
			elif i==len(s)-1 and s[i]!=s[i-1]:
				x.append(s[i])
			elif i>0 and i<len(s)-1:
				if s[i]!=s[i+1] and s[i]!=s[i-1]:
					x.append(s[i])
				if s[i]==s[i+1] and s[i]==s[i-1]:
					x.append(s[i])
		if len(x)==0:
			print("")
		else:
			x = list(set(x))
			x = sorted(x)
			print("".join(x))


import sys
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin,stdout
from collections import defaultdict, deque
from math import log2, ceil, floor

inp=lambda : int(input())
sip=lambda : input()
mulip =lambda : map(int,input().split())
lst=lambda : list(map(int,input().split()))
slst=lambda: list(sip())
arr2d= lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x%2!=0, l)))
evens = lambda l: len(list(filter(lambda x: x%2==0, l)))
mod = pow(10,9)+7
#-------------------------------------------------------
#sys.stdin = open('input.in','r')
for _ in range(inp()):
    s = list(input())
    x = []
    for i in range(len(s)):
        if i==0 and len(s)>1:
            if s[i]!=s[i+1]:
                x.append(s[i])
        if i==len(s)-1 and len(s)>1:
            if s[i]!=s[i-1]:
                x.append(s[i])
        if i!=0 and i!=len(s)-1 and len(s)>2:
            if s[i]!=s[i-1] and s[i]!=s[i+1]:
                x.append(s[i])
    if len(s)==1:
        x.append(s[0])
    if len(x)==0:
        print("")
    else:
        x = list(set(x))
        x = sorted(x)
        print("".join(x))


import sys
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin,stdout
from collections import defaultdict, deque
from math import log2, ceil, floor

inp=lambda : int(input())
sip=lambda : input()
mulip =lambda : map(int,input().split())
lst=lambda : list(map(int,input().split()))
slst=lambda: list(sip())
arr2d= lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x%2!=0, l)))
evens = lambda l: len(list(filter(lambda x: x%2==0, l)))
mod = pow(10,9)+7
#-------------------------------------------------------
#sys.stdin = open('input.in','r')
for _ in range(inp()):
    s = list(input())
    x = []
    if len(s)==1:
        print(s[0])
    else:
        cnt = 1
        tmp = s[0]
        for i in range(1,len(s)):
            #print(tmp)
            if s[i]==tmp:
                cnt+=1
            else:
                if cnt%2==1:
                    x.append(tmp)
                tmp = s[i]
                cnt = 1
        if cnt%2==1:
            x.append(tmp)
        if len(x)==0:
            print("")
        else:
            print("".join(sorted(list(set(x)))))


import sys
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin,stdout
from collections import defaultdict, deque
from math import log2, ceil, floor

inp=lambda : int(input())
sip=lambda : input()
mulip =lambda : map(int,input().split())
lst=lambda : list(map(int,input().split()))
slst=lambda: list(sip())
arr2d= lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x%2!=0, l)))
evens = lambda l: len(list(filter(lambda x: x%2==0, l)))
mod = pow(10,9)+7
#-------------------------------------------------------
#sys.stdin = open('input.in','r')
for _ in range(inp()):
	s = list(input())
	x = defaultdict(list)
	y = [s[0]]
	cnt = 1
	for i in range(1,len(s)):
		if y[-1]==s[i]:
			cnt += 1
		else:
			x[y[-1]].append(cnt)
			cnt = 0
			y.append(s[i])
	res = []
	for i in x:
		for j in x[i]:
			if j%2==1:
				res.append(i)
				break
	if len(res)==0:
		print("")
	else:
		print("".join(sorted(res)))


import sys
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin,stdout
from collections import defaultdict, deque
from math import log2, ceil, floor

inp=lambda : int(input())
sip=lambda : input()
mulip =lambda : map(int,input().split())
lst=lambda : list(map(int,input().split()))
slst=lambda: list(sip())
arr2d= lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x%2!=0, l)))
evens = lambda l: len(list(filter(lambda x: x%2==0, l)))
mod = pow(10,9)+7
#-------------------------------------------------------
#sys.stdin = open('input.in','r')
for _ in range(inp()):
	s = list(input())
	x = []
	if len(s)==1:
		print(s[0])
	elif len(s)==2:
		if s[0]!=s[1]:
			print("".join(sorted(s)))
		else:
			print("")
	else:
		for i in range(len(s)):
			if i==0 and s[i]!=s[i+1]:
				x.append(s[i])
			elif i==len(s)-1 and s[i]!=s[i-1]:
				x.append(s[i])
			elif i>0 and i<len(s)-1:
				if s[i]!=s[i+1] and s[i]!=s[i-1]:
					x.append(s[i])
				if s[i]==s[i+1] and s[i]==s[i-1]:
					x.append(s[i])
		if len(x)==0:
			print("")
		else:
			x = list(set(x))
			x = sorted(x)
			print("".join(x))


import sys
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin,stdout
from collections import defaultdict, deque
from math import log2, ceil, floor

inp=lambda : int(input())
sip=lambda : input()
mulip =lambda : map(int,input().split())
lst=lambda : list(map(int,input().split()))
slst=lambda: list(sip())
arr2d= lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x%2!=0, l)))
evens = lambda l: len(list(filter(lambda x: x%2==0, l)))
mod = pow(10,9)+7
#-------------------------------------------------------
#sys.stdin = open('input.in','r')
for _ in range(inp()):
    s = list(input())
    d = defaultdict(int)
    x = []
    for i in s:
        d[i]+=1
    for i in d:
        if d[i]%2==1:
            x.append(i)
    if len(x)==0:
        print("")
    else:
        x = sorted(x)
        print("".join(x))


import sys
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin,stdout
from collections import defaultdict, deque
from math import log2, ceil, floor

inp=lambda : int(input())
sip=lambda : input()
mulip =lambda : map(int,input().split())
lst=lambda : list(map(int,input().split()))
slst=lambda: list(sip())
arr2d= lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x%2!=0, l)))
evens = lambda l: len(list(filter(lambda x: x%2==0, l)))
mod = pow(10,9)+7
#-------------------------------------------------------
#sys.stdin = open('input.in','r')
for _ in range(inp()):
    s = list(input())
    x = []
    for i in range(len(s)):
        if i==0 and len(s)>1:
            if s[i]!=s[i+1]:
                x.append(s[i])
        if i==len(s)-1 and len(s)>1:
            if s[i]!=s[i-1]:
                x.append(s[i])
        if i!=0 and i!=len(s)-1 and len(s)>2:
            if s[i]!=s[i-1] and s[i]!=s[i+1]:
                x.append(s[i])
    if len(s)==1:
        x.append(s[0])
    if len(x)==0:
        print("")
    else:
        x = sorted(x)
        print("".join(x))


import sys
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin,stdout
from collections import defaultdict, deque
from math import log2, ceil, floor

inp=lambda : int(input())
sip=lambda : input()
mulip =lambda : map(int,input().split())
lst=lambda : list(map(int,input().split()))
slst=lambda: list(sip())
arr2d= lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x%2!=0, l)))
evens = lambda l: len(list(filter(lambda x: x%2==0, l)))
mod = pow(10,9)+7
#-------------------------------------------------------
#sys.stdin = open('input.in','r')
for _ in range(inp()):
    s = list(input())
    x = defaultdict(list)
    y = []
    for i in range(len(s)):
        if len(y)==0:
           y = [s[0]]
           cnt = 1
        elif y[-1]==s[i]:
            cnt += 1
        else:
            x[y[-1]].append(cnt)
            cnt = 1
            y.append(s[i])
    x[y[-1]].append(cnt)
    res = []
    for i in x:
        for j in x[i]:
            if j%2==1:
                res.append(i)
                break
    if len(res)==0:
        print("")
    else:
        print("".join(sorted(res)))


import sys
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from bisect import bisect_right
from bisect import bisect_left
from sys import stdin,stdout
from collections import defaultdict, deque
from math import log2, ceil, floor

inp=lambda : int(input())
sip=lambda : input()
mulip =lambda : map(int,input().split())
lst=lambda : list(map(int,input().split()))
slst=lambda: list(sip())
arr2d= lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x%2!=0, l)))
evens = lambda l: len(list(filter(lambda x: x%2==0, l)))
mod = pow(10,9)+7
#-------------------------------------------------------
#sys.stdin = open('input.in','r')
for _ in range(inp()):
    s = list(input())
    x = []
    for i in range(len(s)):
        if i==0 and len(s)>1:
            if s[i]!=s[i+1]:
                x.append(s[i])
        if i==len(s)-1 and len(s)>1:
            if s[i]!=s[i-1]:
                x.append(s[i])
        if i!=0 and i!=len(s)-1 and len(s)>2:
            if s[i]!=s[i-1] and s[i]!=s[i+1]:
                x.append(s[i])
            if s[i]==s[i+1] and s[i]==s[i-1]:
                x.append(s[i])
    if len(s)==1:
        x.append(s[0])
    if len(x)==0:
        print("")
    else:
        x = sorted(x)
        print("".join(x))


from sys import stdin,stdout
from collections import defaultdict as df
import bisect
t=int(input())
for ii in range(t):
    s=input().rstrip()
    s=[ i for i in s]
    d=df(list)
    count=1

    for i in range(1,len(s)):
        if s[i]==s[i-1]:
            count+=1
        else:
            d[s[i-1]].append(count%2)
            count=1
    d[s[-1]].append(count%2)
    corr=[]

    for i in set(s):
        y=d[i]
        if 1 in y:
            corr.append(i)
    corr=set(corr)
    corr=list(corr)
    corr.sort()
    print(''.join(corr))


from sys import stdin,stdout
from collections import defaultdict as df
import bisect
t=int(input())
for ii in range(t):
    s=input().rstrip()
    s=[ i for i in s]
    d=df(list)
    count=1

    for i in range(1,len(s)):
        if s[i]==s[i-1]:
            count+=1
        else:
            d[s[i-1]].append(count)
            count=1
    d[s[-1]].append(count)
    corr=[]

    for i in set(s):
        y=d[i]
        if 1 in y:
            corr.append(i)
    print(''.join(corr))


from sys import stdin,stdout
from collections import defaultdict as df
import bisect
t=int(input())
for ii in range(t):
    s=input().rstrip()
    s=[ i for i in s]
    d=df(list)
    count=1

    for i in range(1,len(s)):
        if s[i]==s[i-1]:
            count+=1
        else:
            d[s[i-1]].append(count)
            count=1
    d[s[-1]].append(count)
    corr=[]

    for i in set(s):
        y=d[i]
        if 1 in y:
            corr.append(i)
    corr=set(corr)
    corr=list(corr)
    corr.sort()
    print(''.join(corr))


n = int(input())
for j in range(n):
    s = input()
    ans = ''
    for i in range(26):
        c = chr(ord('a') + i)
        if (s.count(c) - s.count(c * 2) * 2) and s.count(c) * 2 != s.count(c * 2):
            ans += c
    print(ans)


n = int(input())
for j in range(n):
    s = input()
    ans = ''
    for i in range(26):
        c = chr(ord('a') + i)
        if s.count(c) % 2 and s.count(c) * 2 != s.count(c * 2):
            ans += c
    print(ans)


n = int(input())
for j in range(n):
    s = input()
    ans = ''
    for i in range(26):
        c = chr(ord('a') + i)
        if s.count(c) % 2:
            ans += c
    print(ans)


n = int(input())
for j in range(n):
    s = input()
    ans = ''
    for i in range(26):
        c = chr(ord('a') + i)
        if s.count(c) % 2 and s.count(c) != s.count(c * 2):
            ans += c
    print(ans)


from itertools import groupby
t = int(input())

for _ in range(t):

    a = list(input())
    x = [(key, len(list(group))) for key, group in groupby(a)]
    answer = list()

    for c, l in x:
        if l%2==1:
            answer.append(c)

    answer.sort()

    print(''.join(answer))


t = int(input())

for _ in range(t):

    a = list(input())
    n = len(a)
    sd = set()
    cc = 0

    # if len(a) == 1:
    #     sd.add(a[0])

    for i in range(len(a)):
        if (a[i-1] != a[i] if i>0 else True) and (a[i] != a[i+1] if i<n-1 else True):
            sd.add(a[i])
        if (a[i-1] == a[i] if i>0 else False) or (a[i] == a[i+1] if i<n-1 else False):
            sd.discard(a[i])

    print(''.join(sorted(list(sd))))


from itertools import groupby
t = int(input())

for _ in range(t):

    a = list(input())
    x = [(key, len(list(group))) for key, group in groupby(a)]
    answer = set()

    for c, l in x:
        if l%2==1:
            answer.add(c)

    answer = list(answer)
    answer.sort()

    print(''.join(answer))


t = int(input())

for _ in range(t):

    a = list(input())
    n = len(a)
    sd = set()
    cc = 0

    if len(a) == 1:
        sd.add(a[0])

    for i in range(len(a)):
        if (a[i-1] != a[i] if i>0 else True) and (a[i] != a[i+1] if i<n-1 else True):
            sd.add(a[i])

    print(''.join(sorted(list(sd))))


proibidos = ['aa', 'bb', 'cc', 'dd', 'ee', 'ff', 'gg', 'hh', 'ii', 'jj', 'kk', 'll', 'mm', 'nn', 'oo', 'pp', 'qq', 'rr', 'ss', 'tt', 'uu', 'vv', 'ww', 'xx', 'yy', 'zz' ]

def solve(res, string, pointer):
    if pointer == 0:
        res = res + string[0]
        return res
    elif pointer == 1 and string[0:2] in proibidos:
        return res
    elif pointer == 1 and string[0:2] not in proibidos:
        res = res + string[0:2]
        return res
    else:
        ultima = string[pointer]
        meio = string[pointer-1]
        primeira = string[pointer-2]

        if ultima != meio:
            res = res + ultima
            pointer -= 1
            return solve(res, string, pointer)
        else:
            pointer -= 2
            return solve(res, string, pointer)

q = int(input())
queries_list = []

for i in range(1,q+1):
    queries_list.append(input())

for query in queries_list:
    aux = ""
    res = "".join(sorted(set(solve(aux, query, len(query) - 1))))
    print(res)


q = int(input())
queries_list = []

for i in range(1,q+1):
    queries_list.append(input())

for query in queries_list:
    res = ''
    gabarito = {}

    if len(query) == 1 or ( len(query) == 2 and query[0] != query[1] ):
        res = query
    else:
        if ( len(query) == 3 and query[0] != query[1] != query[2] ):
            gabarito[query[0]] = 1
            gabarito[query[1]] = 1
            gabarito[query[2]] = 1
        else:
            if query[0] != query[1]:
                gabarito[query[0]] = 1

            for i in range(1, len(query) - 2):
                if query[i - 1] != query[i] and query[i] != query[i + 1]:
                    gabarito[query[i]] = 1      # vai ser printado

            if query[len(query) - 1] != query[len(query) - 2]:
                gabarito[query[len(query) - 1]] = 1

            for letra in gabarito:
                res = res + letra

    print(res)


proibidos = ['aa', 'bb', 'cc', 'dd', 'ee', 'ff', 'gg', 'hh', 'ii', 'jj', 'kk', 'll', 'mm', 'nn', 'oo', 'pp', 'qq', 'rr', 'ss', 'tt', 'uu', 'vv', 'xx', 'yy', 'zz' ]

def solve(res, string, pointer):
    if pointer == 0:
        res = res + string[0]
        return res
    elif pointer == 1 and string[0:2] in proibidos:
        return res
    elif pointer == 1 and string[0:2] not in proibidos:
        res = res + string[0:2]
        return res
    else:
        ultima = string[pointer]
        meio = string[pointer-1]
        primeira = string[pointer-2]

        if ultima != meio:
            res = res + ultima
            pointer -= 1
            return solve(res, string, pointer)
        else:
            pointer -= 2
            return solve(res, string, pointer)

q = int(input())
queries_list = []

for i in range(1,q+1):
    queries_list.append(input())

for query in queries_list:
    aux = ""
    res = "".join(sorted(set(solve(aux, query, len(query) - 1))))
    print(res)


q = int(input())
queries_list = []

for i in range(1,q+1):
    queries_list.append(input())

for query in queries_list:
    res = ''
    gabarito = {}

    if len(query) == 1 or ( len(query) == 2 and query[0] != query[1] ):
        res = query
    else:
        if query[0] != query[2]:
            gabarito[query[0]] = 1

        for i in range(1, len(query) - 2):
            if query[i - 1] == query[i]:
                gabarito[query[i]] = 0      # nao vai ser printado
            elif query[i - 1] != query[i] and query[i] != query[i + 1]:
                gabarito[query[i]] = 1      # vai ser printado

        if query[len(query) - 1] != query[len(query) - 2]:
            gabarito[query[len(query) - 1]] = 1

        for letra in gabarito:
            if gabarito[letra] == 1:
                res = res + letra

    print(res)


q = int(input())
queries_list = []

for i in range(1,q+1):
    queries_list.append(input())

for query in queries_list:
    res = ''
    gabarito = {}

    if len(query) == 1 or ( len(query) == 2 and query[0] != query[1] ):
        res = query
    else:
        if query[0] != query[1]:
            gabarito[query[0]] = 1

        for i in range(1, len(query) - 2):
            if query[i - 1] == query[i]:
                gabarito[query[i]] = 0      # nao vai ser printado
            elif query[i - 1] != query[i] and query[i] != query[i + 1]:
                gabarito[query[i]] = 1      # vai ser printado

        if query[len(query) - 1] != query[len(query) - 2]:
            gabarito[query[len(query) - 1]] = 1

        for letra in gabarito:
            if gabarito[letra] == 1:
                res = res + letra

    print(res)


from itertools import groupby

t = int(input())
while t > 0:
    l = []
    t -= 1
    s = input()
    groups = [''.join(g) for _, g in groupby(s)]

    for x in groups:
        if len(x) % 2 == 1:
            l.append(x[0])

    ans = ""
    l = set(l)
    for i in l:
        ans += i
    print(ans)


from itertools import groupby

t = int(input())
while t > 0:
    l = []
    t -= 1
    s = input()
    groups = [''.join(g) for _, g in groupby(s)]

    for x in groups:
        if len(x) % 2 == 1:
            l.append(x[0])

    ans = ""
    l = sorted(set(l))
    for i in l:
        ans += i
    print(ans)


from itertools import groupby

t = int(input())
while t > 0:
    l = []
    t -= 1
    s = input()
    groups = [''.join(g) for _, g in groupby(s)]

    for x in groups:
        if len(x) % 2 == 1:
            l.append(x[0])

    ans = ""
    l.sort()
    for i in l:
        ans += i
    print(ans)


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <queue>
#include <vector>
#define mp make_pair

using namespace std;
vector<pair<int,int> > VV;

int main()
{
 int n, h, d,i,j;
 cin>>n>>d>>h;
 if(d == 1) {
    if(n == 2 && h == 1) {
    	cout<<"1 2"<<endl;
    	return 0;
	}
	else {
		cout<<"-1"<<endl;
    	return 0;
	}
 }
  if(h * 2 < d) {cout<<"-1"; return 0;}
 if(d > h){
 	for(i = 1; i <= h; i++) cout<<i<<" "<<i + 1<<endl;
        cout<<"1 "<<h + 2<<endl;
         for(i = h + 2; i <= d; i++) cout<<i<<" "<<i+1<<endl;
          for(i = d + 2; i <= n; i++) cout<<"1 "<<i<<endl;
        return 0;
		}
	for(i = 1; i <= h; i++) cout<<i<<" "<<i + 1<<endl;
	for(i = h + 2; i <= n; i++) cout<<i - h<<" "<<i<<endl;
 return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <queue>
#include <vector>
#define mp make_pair

using namespace std;
vector<pair<int,int> > VV;

int main()
{
 int n, h, d,i,j;
 cin>>n>>d>>h;
 if(d == 1) {
    if(n == 2 && h == 1) {
    	cout<<"1 2"<<endl;
    	return 0;
	}
	else {
		cout<<"-1"<<endl;
    	return 0;
	}
 }
  if(h * 2 < d) {cout<<"-1"; return 0;}
 if(d > h){
 	for(i = 1; i <= h; i++) cout<<i<<" "<<i + 1<<endl;
        cout<<"1 "<<h + 2<<endl;
         for(i = h + 2; i <= d; i++) cout<<i<<" "<<i+1<<endl;
          for(i = d + 2; i <= n; i++) cout<<"1 "<<i<<endl;
        return 0;
		}
	for(i = 1; i <= h; i++) cout<<i<<" "<<i + 1<<endl;
	for(i = h + 2; i <= n; i++) cout<<"1 "<<i<<endl;
 return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <queue>
#include <vector>
#define mp make_pair

using namespace std;
vector<pair<int,int> > VV;

int main()
{
 int n, h, d,i,j;
 cin>>n>>d>>h;
 if(d == 1) {
    if(n == 2 && h == 1) {
    	cout<<"1 2"<<endl;
    	return 0;
	}
	else {
		cout<<"-1"<<endl;
    	return 0;
	}
 }
  if(h * 2 < d) {cout<<"-1"; return 0;}
 if(d > h){
 	for(i = 1; i <= h; i++) cout<<i<<" "<<i + 1<<endl;
        cout<<"1 "<<h + 2<<endl;
         for(i = h + 2; i <= d; i++) cout<<i<<" "<<i+1<<endl;
          for(i = d + 2; i <= n; i++) cout<<"1 "<<i<<endl;
        return 0;
		}
	for(i = 1; i <= h; i++) cout<<i<<" "<<i + 1<<endl;
	for(i = h + 2; i <= n; i++) cout<<"2 "<<i<<endl;
 return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <queue>
#include <vector>
#define mp make_pair

using namespace std;
vector<pair<int,int> > VV;

int main()
{
 int n, h, d,i,j;
 cin>>n>>d>>h;
 if(d == 1 && n != 2 && h != 1) {cout<<"-1";return 0;}
  if(h * 2 < d || d < h) {cout<<"-1"; return 0;}
  if(d == h) {
  	for(i = 1; i <= h; i++) cout<<i<<" "<<i+1<<endl;
  	return 0;
  }
 	for(i = 1; i <= h; i++) cout<<i<<" "<<i + 1<<endl;
        cout<<"1 "<<h + 2<<endl;
         for(i = h + 2; i <= d; i++) cout<<i<<" "<<i+1<<endl;
          for(i = d + 2; i <= n; i++) cout<<"1 "<<i<<endl;
 return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <queue>
#include <vector>
#define mp make_pair

using namespace std;
vector<pair<int,int> > VV;

int main()
{
 int n, h, d,i,j;
 cin>>n>>d>>h;
 if(d == 1 && n != 2 && h != 1) {cout<<"-1", return 0;}
  if(d != n - 1 || h != n - 1) if(h * 2 < d || d <= h) {cout<<"-1"; return 0;}
 	d = d - h;
 	for(i = 1; i <= h; i++) VV.push_back(mp(i,i+1));
     if(d != 0)
     {
         VV.push_back(mp(1,h + 2));
         for(i = h + 2; i <= h + d; i++) VV.push_back(mp(i,i+1));
          for(i = h + d + 2; i <= n; i++) VV.push_back(mp(i,1));
	 }
	 for(i = 0; i < n - 1; i++) cout<<VV[i].first<<" "<<VV[i].second<<endl;
 return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <queue>
#include <vector>
#define mp make_pair

using namespace std;
vector<pair<int,int> > VV;

int main()
{
 int n, h, d,i,j;
 cin>>n>>d>>h;
 if(d == 1) {
    if(n == 2 && h == 1) {
    	cout<<"1 2"<<endl;
    	return 0;
	}
	else {
		cout<<"0"<<endl;
    	return 0;
	}
 }
  if(h * 2 < d) {cout<<"-1"; return 0;}
 if(d > h){
 	for(i = 1; i <= h; i++) cout<<i<<" "<<i + 1<<endl;
        cout<<"1 "<<h + 2<<endl;
         for(i = h + 2; i <= d; i++) cout<<i<<" "<<i+1<<endl;
          for(i = d + 2; i <= n; i++) cout<<"1 "<<i<<endl;
        return 0;
		}
	for(i = 1; i <= h; i++) cout<<i<<" "<<i + 1<<endl;
	for(i = h + 2; i <= n; i++) cout<<"1 "<<i<<endl;
 return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <queue>
#include <vector>
#define mp make_pair

using namespace std;
vector<pair<int,int> > VV;

int main()
{
 int n, h, d,i,j;
 cin>>n>>d>>h;
  if(d != n - 1 || h != n - 1) if(h * 2 < d || h == d) {cout<<"-1"; return 0;}
 	d = d - h;
 	for(i = 1; i <= h; i++) VV.push_back(mp(i,i+1));
     if(d != 0)
     {
         VV.push_back(mp(1,h + 2));
         for(i = h + 2; i <= h + d; i++) VV.push_back(mp(i,i+1));
          for(i = h + d + 2; i <= n; i++) VV.push_back(mp(1,i));
	 }
	 int sz = VV.size();
	 for(i = 0; i < sz; i++) cout<<VV[i].first<<" "<<VV[i].second<<endl;
 return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <queue>
#include <vector>
#define mp make_pair

using namespace std;
vector<pair<int,int> > VV;

int main()
{
 int n, h, d,i,j;
 cin>>n>>d>>h;
 if(d == 1) {
    if(n == 2 && h == 1) {
    	cout<<"1 2"<<endl;
    	return 0;
	}
	else {
		cout<<"0"<<endl;
    	return 0;
	}
 }
  if(d != n - 1 || h != n - 1) if(h * 2 < d || d <= h) {cout<<"-1"; return 0;}
 	for(i = 1; i <= h; i++) cout<<i<<" "<<i + 1<<endl;
        cout<<"1 "<<h + 2<<endl;
         for(i = h + 2; i <= d; i++) cout<<i<<" "<<i+1<<endl;
          for(i = d + 2; i <= n; i++) cout<<"1 "<<i<<endl;
 return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <queue>
#include <vector>
#define mp make_pair

using namespace std;
vector<pair<int,int> > VV;

int main()
{
 int n, h, d,i,j;
 cin>>n>>d>>h;
 if(d == 1) {
    if(n == 2 && h == 1) {
    	cout<<"1 2"<<endl;
    	return 0;
	}
	else {
		cout<<"0"<<endl;
    	return 0;
	}
 }
  if(h * 2 < d) {cout<<"-1"; return 0;}
 if(d > h){
 	for(i = 1; i <= h; i++) cout<<i<<" "<<i + 1<<endl;
        cout<<"1 "<<h + 2<<endl;
         for(i = h + 2; i <= d; i++) cout<<i<<" "<<i+1<<endl;
          for(i = d + 2; i <= n; i++) cout<<"1 "<<i<<endl;
        return 0;
		}
	for(i = 1; i <= h; i++) cout<<i<<" "<<i + 1<<endl;
 return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <queue>
#include <vector>
#define mp make_pair

using namespace std;
vector<pair<int,int> > VV;

int main()
{
 int n, h, d,i,j;
 cin>>n>>d>>h;
  if(d != n - 1 || h != n - 1) if(h * 2 < d || d <= h) {cout<<"-1"; return 0;}
 	d = d - h;
 	for(i = 1; i <= h; i++) VV.push_back(mp(i,i+1));
     if(d != 0)
     {
         VV.push_back(mp(1,h + 2));
         for(i = h + 2; i <= h + d; i++) VV.push_back(mp(i,i+1));
          for(i = h + d + 2; i <= n; i++) VV.push_back(mp(i,1));
	 }
	 for(i = 0; i < n; i++) cout<<VV[i].first<<" "<<VV[i].second<<endl;
 return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <queue>
#include <vector>
#define mp make_pair

using namespace std;
vector<pair<int,int> > VV;

int main()
{
 int n, h, d,i,j;
 cin>>n>>d>>h;
 if(d == 1) {
    if(n == 2 && h == 1) {
    	cout<<"1 2"<<endl;
    	return 0;
	}
	else {
		cout<<"0"<<endl;
    	return 0;
	}
 }
  if(d != n - 1 || h != n - 1) if(h * 2 < d || d < h) {cout<<"-1"; return 0;}
 	for(i = 1; i <= h; i++) cout<<i<<" "<<i + 1<<endl;
        cout<<"1 "<<h + 2<<endl;
         for(i = h + 2; i <= d; i++) cout<<i<<" "<<i+1<<endl;
          for(i = d + 2; i <= n; i++) cout<<"1 "<<i<<endl;
 return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <queue>
#include <vector>
#define mp make_pair

using namespace std;
vector<pair<int,int> > VV;

int main()
{
 int n, h, d,i,j;
 cin>>n>>d>>h;
 if(d == 1 && n != 2 && h != 1) {cout<<"-1";return 0;}
  if(d != n - 1 || h != n - 1) if(h * 2 < d || d <= h) {cout<<"-1"; return 0;}
 	d = d - h;
 	for(i = 1; i <= h; i++) VV.push_back(mp(i,i+1));
     if(d != 0)
     {
         VV.push_back(mp(1,h + 2));
         for(i = h + 2; i <= h + d; i++) VV.push_back(mp(i,i+1));
          for(i = h + d + 2; i <= n; i++) VV.push_back(mp(i,1));
	 }
	 for(i = 0; i < n - 1; i++) cout<<VV[i].first<<" "<<VV[i].second<<endl;
 return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <sstream>
#include <cstdio>
#include <ctime>
#include <cctype>
#include <cassert>
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef __int64 ll;

#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define max(a, b) ((a)>(b)?(a):(b))
#define mp make_pair
#define pb push_back
#define all(v) v.begin(),v.end()

using namespace std;

int main(){
	//freopen("D:\\in.txt","r",stdin);
	int n,d,h;
	cin>>n>>d>>h;
	if(h<(d+1)/2){
	    cout<<"-1"<<endl;
	    return 0;
	}
	if(d==1&&n>2){
		cout<<"-1"<<endl;
	    return 0;
	}
	if(d==2&&n>3&&h==1){
		cout<<"-1"<<endl;
	    return 0;
	}

	for(int i=1;i<=h;i++){
		cout<<i<<" "<<i+1<<endl;
	}
	if(d!=h){
		cout<<"1"<<" "<<h+2<<endl;
	}
	for(int i=h+2;i<d+1;i++){
		cout<<i<<" "<<i+1<<endl;
	}

	for(int i=d+2;i<=n;i++){
		cout<<"2"<<" "<<i<<endl;
	}

	return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <sstream>
#include <cstdio>
#include <ctime>
#include <cctype>
#include <cassert>
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef __int64 ll;

#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define max(a, b) ((a)>(b)?(a):(b))
#define mp make_pair
#define pb push_back
#define all(v) v.begin(),v.end()

using namespace std;

int main(){
	//freopen("D:\\in.txt","r",stdin);
	int n,d,h;
	cin>>n>>d>>h;
	if(h<(h+1)/2){
	    cout<<"-1"<<endl;
	    return 0;
	}

	for(int i=1;i<=h;i++){
		cout<<i<<" "<<i+1<<endl;
	}
	if(d!=h){
		cout<<"1"<<" "<<h+2<<endl;
	}
	for(int i=h+2;i<d+1;i++){
		cout<<i<<" "<<i+1<<endl;
	}
	for(int i=d+2;i<=n;i++){
		cout<<"2"<<" "<<i<<endl;
	}

	return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <sstream>
#include <cstdio>
#include <ctime>
#include <cctype>
#include <cassert>
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef __int64 ll;

#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define max(a, b) ((a)>(b)?(a):(b))
#define mp make_pair
#define pb push_back
#define all(v) v.begin(),v.end()

using namespace std;

int main(){
	//freopen("D:\\in.txt","r",stdin);
	int n,d,h;
	cin>>n>>d>>h;
	if(h<(h+1)/2){
	    cout<<"-1"<<endl;
	    return 0;
	}
	int half=d/2;
	for(int i=1;i<=half;i++){
		cout<<i<<" "<<i+1<<endl;
	}
	for(int i=half+1;i<=d+1;i++){
		if(i==half+1) cout<<"1"<<" "<<i+1<<endl;
		else cout<<i<<" "<<i+1<<endl;
	}
	for(int i=d+2;i<=n;i++){
		cout<<"2"<<" "<<i<<endl;
	}

	return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <sstream>
#include <cstdio>
#include <ctime>
#include <cctype>
#include <cassert>
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef __int64 ll;

#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define max(a, b) ((a)>(b)?(a):(b))
#define mp make_pair
#define pb push_back
#define all(v) v.begin(),v.end()

using namespace std;

int main(){
	//freopen("D:\\in.txt","r",stdin);
	int n,d,h;
	cin>>n>>d>>h;
	if(h<(d+1)/2){
	    cout<<"-1"<<endl;
	    return 0;
	}
	if(d==1&&n>2){
		cout<<"-1"<<endl;
	    return 0;
	}

	for(int i=1;i<=h;i++){
		cout<<i<<" "<<i+1<<endl;
	}
	if(d!=h){
		cout<<"1"<<" "<<h+2<<endl;
	}
	for(int i=h+2;i<d+1;i++){
		cout<<i<<" "<<i+1<<endl;
	}

	for(int i=d+2;i<=n;i++){
		cout<<"1"<<" "<<i<<endl;
	}

	return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <sstream>
#include <cstdio>
#include <ctime>
#include <cctype>
#include <cassert>
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef __int64 ll;

#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define max(a, b) ((a)>(b)?(a):(b))
#define mp make_pair
#define pb push_back
#define all(v) v.begin(),v.end()

using namespace std;

int main(){
	//freopen("D:\\in.txt","r",stdin);
	int n,d,h;
	cin>>n>>d>>h;
	if(h<(d+1)/2){
	    cout<<"-1"<<endl;
	    return 0;
	}
	if(d==1&&n>2){
		cout<<"-1"<<endl;
	    return 0;
	}
	for(int i=1;i<=h;i++){
		cout<<i<<" "<<i+1<<endl;
	}
	if(d!=h){
		cout<<"1"<<" "<<h+2<<endl;
	}
	for(int i=h+2;i<d+1;i++){
		cout<<i<<" "<<i+1<<endl;
	}

	for(int i=d+2;i<=n;i++){
		cout<<"2"<<" "<<i<<endl;
	}

	return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <sstream>
#include <cstdio>
#include <ctime>
#include <cctype>
#include <cassert>
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef __int64 ll;

#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define max(a, b) ((a)>(b)?(a):(b))
#define mp make_pair
#define pb push_back
#define all(v) v.begin(),v.end()

using namespace std;

int main(){
	//freopen("D:\\in.txt","r",stdin);
	int n,d,h;
	cin>>n>>d>>h;
	if(h<(d+1)/2){
	    cout<<"-1"<<endl;
	    return 0;
	}
	if(d==1&&n>2){
		cout<<"-1"<<endl;
	    return 0;
	}

	for(int i=1;i<=h;i++){
		cout<<i<<" "<<i+1<<endl;
	}
	if(d!=h){
		cout<<"1"<<" "<<h+2<<endl;
	}
	for(int i=h+2;i<d+1;i++){
		cout<<i<<" "<<i+1<<endl;
	}

    if(d==h)
	    for(int i=d+2;i<=n;i++){
		    cout<<"2"<<" "<<i<<endl;
	    }
	else
	    for(int i=d+2;i<=n;i++){
		    cout<<"1"<<" "<<i<<endl;
	    }

	return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <sstream>
#include <cstdio>
#include <ctime>
#include <cctype>
#include <cassert>
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef __int64 ll;

#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define max(a, b) ((a)>(b)?(a):(b))
#define mp make_pair
#define pb push_back
#define all(v) v.begin(),v.end()

using namespace std;

int main(){
	//freopen("D:\\in.txt","r",stdin);
	int n,d,h;
	cin>>n>>d>>h;
	if(h<(d+1)/2){
	    cout<<"-1"<<endl;
	    return 0;
	}

	for(int i=1;i<=h;i++){
		cout<<i<<" "<<i+1<<endl;
	}
	if(d!=h){
		cout<<"1"<<" "<<h+2<<endl;
	}
	for(int i=h+2;i<d+1;i++){
		cout<<i<<" "<<i+1<<endl;
	}
	for(int i=d+2;i<=n;i++){
		cout<<"2"<<" "<<i<<endl;
	}

	return 0;
}


#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define maxN long(2e5)
#define ii pair<long,long>
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
vector<ii> edge;
int main()
{
	long n,d,h;
	scanf("%ld%ld%ld",&n,&d,&h);
	if (n==2 && d==1 && h==1)
	{
		printf("1 2");
		return 0;
	}
	else if (d==1 && h==1) printf("-1");
	else
	{
		long cur=h+1;
		for (long i=1; i<=h; ++i) edge.pb(mp(i,i+1));
		d-=h;
		if (d>n-cur || d>h)
		{
			printf("-1");
			return 0;
		}
		if (!d) ++cur;
		while (d>0)
		{
			edge.pb(mp(cur,cur+1));
			--d,++cur;
		}
		for (long i=cur; i<=n; ++i) edge.pb(mp(i,h));
		//output
		for (long i=0; i<edge.size(); ++i) printf("%ld %ld\n",edge[i].fi,edge[i].se);
	}
	return 0;
}


#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define maxN long(2e5)
#define ii pair<long,long>
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
vector<ii> edge;
int main()
{
	long n,d,h;
	scanf("%ld%ld%ld",&n,&d,&h);
	if (n==2 && d==1 && h==1)
	{
		printf("1 2");
		return 0;
	}
	else if (d==1 && h==1) printf("-1");
	else
	{
		long cur=h+1;
		for (long i=1; i<=h; ++i) edge.pb(mp(i,i+1));
		d-=h;
		if (d>n-cur || d>h)
		{
			printf("-1");
			return 0;
		}
		if (!d) for (long i=cur+1; i<=n; ++i) edge.pb(mp(i,h));
		else
		{
			++cur;
			while (d>0)
			{
				edge.pb(mp(cur,cur+1));
				--d,++cur;
			}
			for (long i=cur; i<=n; ++i) edge.pb(mp(i,h));
		}
		//output
		for (long i=0; i<edge.size(); ++i) printf("%ld %ld\n",edge[i].fi,edge[i].se);
	}
	return 0;
}


#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define maxN long(2e5)
#define ii pair<long,long>
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
vector<ii> edge;
int main()
{
	long n,d,h;
	scanf("%ld%ld%ld",&n,&d,&h);
	if (n==2 && d==1 && h==1)
	{
		printf("1 2");
		return 0;
	}
	else if (d==1 && h==1) printf("-1");
	else
	{
		long cur=h+1;
		for (long i=1; i<=h; ++i) edge.pb(mp(i,i+1));
		d-=h;
		if (d>n-cur || d>h)
		{
			printf("-1");
			return 0;
		}
		if (!d) for (long i=cur+1; i<=n; ++i) edge.pb(mp(i,h));
		else
		{
			++cur;
			edge.pb(mp(1,cur));
			--d;
			++cur;
			while (d>0)
			{
				edge.pb(mp(cur,cur+1));
				--d,++cur;
			}
			for (long i=cur; i<=n; ++i) edge.pb(mp(i,h));
		}
		//output
		for (long i=0; i<edge.size(); ++i) printf("%ld %ld\n",edge[i].fi,edge[i].se);
	}
	return 0;
}


#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define maxN long(2e5)
#define ii pair<long,long>
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
vector<ii> edge;
int main()
{
	long n,d,h;
	scanf("%ld%ld%ld",&n,&d,&h);
	if (n==2 && d==1 && h==1)
	{
		printf("1 2");
		return 0;
	}
	else if (d==1 && h==1) printf("-1");
	else
	{
		long cur=h+1;
		for (long i=1; i<=h; ++i) edge.pb(mp(i,i+1));
		d-=h;
		if (d>n-cur || d>h)
		{
			printf("-1");
			return 0;
		}
		--d;
		++cur;
		edge.pb(mp(1,cur));
		while (d>0)
		{
			edge.pb(mp(cur,cur+1));
			--d,++cur;
		}
		++cur;
		for (long i=cur; i<=n; ++i) edge.pb(mp(i,h));
		//output
		for (long i=0; i<edge.size(); ++i) printf("%ld %ld\n",edge[i].fi,edge[i].se);
	}
	return 0;
}


#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define maxN long(2e5)
#define ii pair<long,long>
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
vector<ii> edge;
int main()
{
	long n,d,h;
	scanf("%ld%ld%ld",&n,&d,&h);
	if (n==2 && d==1 && h==1)
	{
		printf("1 2");
		return 0;
	}
	else if (d==1 && h==1) printf("-1");
	else
	{
		long cur=h+1;
		for (long i=1; i<=h; ++i) edge.pb(mp(i,i+1));
		d-=h;
		if (d>n-cur || d>h)
		{
			printf("-1");
			return 0;
		}
		--d;
		++cur;
		while (d>0)
		{
			edge.pb(mp(cur,cur+1));
			--d,++cur;
		}
		for (long i=cur; i<=n; ++i) edge.pb(mp(i,h));
		//output
		for (long i=0; i<edge.size(); ++i) printf("%ld %ld\n",edge[i].fi,edge[i].se);
	}
	return 0;
}


#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define maxN long(2e5)
#define ii pair<long,long>
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
vector<ii> edge;
int main()
{
	long n,d,h;
	scanf("%ld%ld%ld",&n,&d,&h);
	if (n==2 && d==1 && h==1)
	{
		printf("1 2");
		return 0;
	}
	else if (d==1 && h==1) printf("-1");
	else
	{
		long cur=h+1;
		for (long i=1; i<=h; ++i) edge.pb(mp(i,i+1));
		d-=h;
		if (d>n-cur || d>h)
		{
			printf("-1");
			return 0;
		}
		--d;
		++cur;
		if (cur<=n) edge.pb(mp(1,cur));
		while (d>0)
		{
			edge.pb(mp(cur,cur+1));
			--d,++cur;
		}
		++cur;
		for (long i=cur; i<=n; ++i) edge.pb(mp(i,h));
		//output
		for (long i=0; i<edge.size(); ++i) printf("%ld %ld\n",edge[i].fi,edge[i].se);
	}
	return 0;
}


#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define maxN long(2e5)
#define ii pair<long,long>
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
vector<ii> edge;
int main()
{
	long n,d,h;
	scanf("%ld%ld%ld",&n,&d,&h);
	if (n==2 && d==1 && h==1)
	{
		printf("1 2");
		return 0;
	}
	else if (d==1 && h==1) printf("-1");
	else
	{
		long cur=h+1;
		for (long i=1; i<=h; ++i) edge.pb(mp(i,i+1));
		d-=h;
		if (d>n-cur || d>h)
		{
			printf("-1");
			return 0;
		}
		if (d) ++cur,edge.pb(mp(1,cur)),--d;
		while (d>0)
		{
			edge.pb(mp(cur,cur+1));
			--d,++cur;
		}
		for (long i=cur+1; i<=n; ++i) edge.pb(mp(i,h));
		//output
		for (long i=0; i<edge.size(); ++i) printf("%ld %ld\n",edge[i].fi,edge[i].se);
	}
	return 0;
}


#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define maxN long(2e5)
#define ii pair<long,long>
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
vector<ii> edge;
int main()
{
	long n,d,h;
	scanf("%ld%ld%ld",&n,&d,&h);
	if (n==2 && d==1 && h==1)
	{
		printf("1 2");
		return 0;
	}
	else if (d>2*h) printf("-1");
	else if (n>2 && d==1 && h==1) printf("-1");
	else
	{
		long cur=h+2,k=h;
		for (long i=1; i<=h; ++i) edge.pb(mp(i,i+1));
		while (d>k)
		{
			if (k==h) edge.pb(mp(1,cur));
			if (k!=h) edge.pb(mp(cur-1,cur));
			++k,++cur;
		}
		while (cur<=n) edge.pb(mp(h,cur)),++cur;
		//output
		for (long i=0; i<edge.size(); ++i) printf("%ld %ld\n",edge[i].fi,edge[i].se);
	}
	return 0;
}


#include<cstdio>
int main(){
    int n,d,k,a,e,f,g,h;
    while(scanf("%d%d%d",&n,&d,&h)!=EOF){
        if(d>2*h){
           printf("-1\n");
           continue;
        }
        for(e=1;e<=h;e++){
            //printf("%d %d ",e,h);
            printf("%d %d\n",e+1,e);
        }
        for(e++;e<=d+1;e++){
            if(e!=h+2)printf("%d %d\n",e,e-1);
            else printf("%d 1\n",e);
        }
        for(;e<=n;e++){
            printf("%d 1\n",e);
        }
    }
    return 0;
}


#include<cstdio>
int main(){
    int n,d,k,a,e,f,g,h;
    while(scanf("%d%d%d",&n,&d,&h)!=EOF){
        if(d>2*h){
           printf("-1\n");
           continue;
        }
        for(e=1;e<=h;e++){
            //printf("%d %d ",e,h);
            printf("%d %d\n",e+1,e);
        }
        for(e++;e<=d;e++){
            if(e!=h+1)printf("%d %d\n",e,e-1);
            else printf("%d 1\n",e);
        }
        for(;e<=n;e++){
            printf("%d 1\n",e);
        }
    }
    return 0;
}


#include<cstdio>
int main(){
    int n,d,k,a,e,f,g,h;
    while(scanf("%d%d%d",&n,&d,&h)!=EOF){
        if(d>2*h){
           printf("-1\n");
           continue;
        }
        for(e=1;e<=h;e++){
            printf("%d %d\n",e+1,e);
        }
        for(e++;e<=d+1;e++){
            if(e!=h+1)printf("%d %d\n",e,e-1);
            else printf("%d 1\n",e);
        }
        for(;e<=n;e++){
            printf("%d 1\n",e);
        }
    }
    return 0;
}


#include<cstdio>
int main(){
    int n,d,k,a,e,f,g,h;
    while(scanf("%d%d%d",&n,&d,&h)!=EOF){
        if(d>2*h){
           printf("-1\n");
           continue;
        }
        for(e=1;e<h;e++){
            printf("%d %d\n",e+1,e);
        }
        for(e++;e<=d+1;e++){
            if(e!=h+1)printf("%d %d\n",e,e-1);
            else printf("%d 1\n",e);
        }
        for(;e<=n;e++){
            printf("%d 1\n",e);
        }
    }
    return 0;
}


#include<cstdio>
int main(){
    int n,d,k,a,e,f,g,h;
    while(scanf("%d%d%d",&n,&d,&h)!=EOF){
        if(d>2*h){
           printf("-1\n");
           continue;
        }
        for(e=1;e<=h;e++){
            //printf("%d %d ",e,h);
            printf("%d %d\n",e+1,e);
        }
        for(e++;e<=d+1;e++){
            if(e!=h+2)printf("%d %d\n",e,e-1);
            else printf("%d 1\n",e);
        }
        if(d>h){
        for(;e<=n;e++){
            printf("%d 1\n",e);
        }

        }
        else{
            for(;e<=n;e++){
                printf("%d 2\n",e);
            }
        }
    }
    return 0;
}


#include<cstdio>
int main(){
    int n,d,k,a,e,f,g,h;
    while(scanf("%d%d%d",&n,&d,&h)!=EOF){
        if(d>2*h){
           printf("-1\n");
           continue;
        }
        for(e=1;e<=h;e++){
            printf("%d %d\n",e+1,e);
        }
        for(;e<=d+1;e++){
            if(e!=h+1)printf("%d %d\n",e,e-1);
            else printf("%d 1\n",e);
        }
        for(;e<=n;e++){
            printf("%d 1\n",e);
        }
    }
    return 0;
}


#include<cstdio>
int main(){
    int n,d,k,a,e,f,g,h;
    while(scanf("%d%d%d",&n,&d,&h)!=EOF){
        if(d>2*h){
           printf("-1\n");
           continue;
        }
        for(e=1;e<=h;e++){
            printf("%d %d ",e,h);
            printf("%d %d\n",e+1,e);
        }
        for(e++;e<=d;e++){
            //if(e!=h+1)printf("%d %d\n",e,e-1);
            else printf("%d 1\n",e);
        }
        for(;e<=n;e++){
            printf("%d 1\n",e);
        }
    }
    return 0;
}


#include<cstdio>
int main(){
    int n,d,k,a,e,f,g,h;
    while(scanf("%d%d%d",&n,&d,&h)!=EOF){
        if(d>2*h){
           printf("-1\n");
           continue;
        }
        for(e=1;e<=h;e++){
            printf("%d %d\n",e+1,e);
        }
        for(e++;e<=d;e++){
            if(e!=h+1)printf("%d %d\n",e,e-1);
            else printf("%d 1\n",e);
        }
        for(;e<=n;e++){
            printf("%d 1\n",e);
        }
    }
    return 0;
}


#include<cstdio>
int main(){
    int n,d,k,a,e,f,g,h;
    while(scanf("%d%d%d",&n,&d,&h)!=EOF){
        if(d>2*h){
           printf("-1\n");
           continue;
        }
        for(e=1;e<h;e++){
            printf("%d %d\n",e+1,e);
        }
        for(e++;e<=d;e++){
            if(e!=h+1)printf("%d %d\n",e,e-1);
            else printf("%d 1\n",e);
        }
        for(;e<=n;e++){
            printf("%d 1\n",e);
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,d,h;

vector<int> G[100010];
bool vis[100010];

bool can(int u, int depth) {
    if(depth > h) return 0;
    int ans = 1;
    for (int v: G[u])
        ans &= can(v, depth + 1);
    return ans;
}

int main() {
    cin >> n >> d >> h;
    int last = 1;
    int distance = 0;
    for (int i = 0; i < h; ++i) {
        G[last].push_back(last + 1);
        vis[last] = vis[last + 1] = 1;
        distance++;
        last++;
    }
    last++;
    bool first = 1;
    int depth = 0;
    while(distance < d) {
        if(first) {
            G[1].push_back(last), first = 0;
            vis[last] = 1;
        }
        else {
            G[last].push_back(last + 1);
            vis[last] = vis[last + 1] = 1;
            last++;
        }
        distance++;
        depth++;
    }

    if(depth > h) return cout << "-1\n",0;
    for (int i = 1; i <= n; ++i)
        if(!vis[i])
            G[h].push_back(i);
    if(!can(1,0)) return cout << "-1\n",0;

    for (int i = 1; i <= n; ++i)
        for (int x: G[i])
            cout << i << " " << x << "\n";

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,d,h;

vector<int> G[100010];
bool vis[100010];
int main() {
    cin >> n >> d >> h;
    int last = 1;
    int distance = 0;
    for (int i = 0; i < h; ++i) {
        G[last].push_back(last + 1);
        vis[last] = vis[last + 1] = 1;
        distance++;
        last++;
    }
    last++;
    bool first = 1;
    int depth = 0;
    while(distance < d) {
        if(first) {
            G[1].push_back(last), first = 0;
            vis[last] = 1;
        }
        else {
            G[last].push_back(last + 1), last++;
            vis[last] = vis[last + 1] = 1;
        }
        distance++;
        depth++;
    }
    if(depth > h) return cout << "-1\n",0;
    for (int i = 1; i <= n; ++i)
        if(!vis[i]) G[1].push_back(i);

    for (int i = 1; i <= n; ++i)
        for (int x: G[i])
            cout << i << " " << x << "\n";

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,d,h;

vector<int> G[100010];
bool vis[100010];
int main() {
    cin >> n >> d >> h;
    int last = 1;
    int distance = 0;
    for (int i = 0; i < h; ++i) {
        G[last].push_back(last + 1);
        vis[last] = vis[last + 1] = 1;
        distance++;
        last++;
    }
    last++;
    bool first = 1;
    int depth = 0;
    while(distance < d) {
        if(first) {
            G[1].push_back(last), first = 0;
            vis[last] = 1;
        }
        else {
            G[last].push_back(last + 1);
            vis[last] = vis[last + 1] = 1;
            last++;
        }
        distance++;
        depth++;
    }
    if(depth > h) return cout << "-1\n",0;
    for (int i = 1; i <= n; ++i)
        if(!vis[i])
            G[2].push_back(i);

    for (int i = 1; i <= n; ++i)
        for (int x: G[i])
            cout << i << " " << x << "\n";

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,d,h;

vector<int> G[100010];
bool vis[100010];
int main() {
    cin >> n >> d >> h;
    int last = 1;
    int distance = 0;
    for (int i = 0; i < h; ++i) {
        G[last].push_back(last + 1);
        vis[last] = vis[last + 1] = 1;
        distance++;
        last++;
    }
    last++;
    bool first = 1;
    int depth = 0;
    while(distance < d) {
        if(first) {
            G[1].push_back(last), first = 0;
            vis[last] = 1;
        }
        else {
            G[last].push_back(last + 1);
            vis[last] = vis[last + 1] = 1;
            last++;
        }
        distance++;
        depth++;
    }

    if(depth > h or d <= h) return cout << "-1\n",0;
    for (int i = 1; i <= n; ++i)
        if(!vis[i])
            G[2].push_back(i);

    for (int i = 1; i <= n; ++i)
        for (int x: G[i])
            cout << i << " " << x << "\n";

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,d,h;

vector<int> G[100010];
bool vis[100010];
int main() {
    cin >> n >> d >> h;
    int last = 1;
    int distance = 0;
    for (int i = 0; i < h; ++i) {
        G[last].push_back(last + 1);
        vis[last] = vis[last + 1] = 1;
        distance++;
        last++;
    }
    last++;
    bool first = 1;
    int depth = 0;
    while(distance < d) {
        if(first) {
            G[1].push_back(last), first = 0;
            vis[last] = 1;
        }
        else {
            G[last].push_back(last + 1);
            vis[last] = vis[last + 1] = 1;
            last++;
        }
        distance++;
        depth++;
    }
    if(depth > h) return cout << "-1\n",0;
    for (int i = 1; i <= n; ++i)
        if(!vis[i])
            G[1].push_back(i);

    for (int i = 1; i <= n; ++i)
        for (int x: G[i])
            cout << i << " " << x << "\n";

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,d,h;

vector<int> G[100010];
bool vis[100010];

bool can(int u, int depth) {
    if(depth > h) return 0;
    int ans = 1;
    for (int v: G[u])
        ans &= can(v, depth + 1);
    return ans;
}

int main() {
    cin >> n >> d >> h;
    int last = 1;
    int distance = 0;
    for (int i = 0; i < h; ++i) {
        G[last].push_back(last + 1);
        vis[last] = vis[last + 1] = 1;
        distance++;
        last++;
    }
    last++;
    bool first = 1;
    int depth = 0;
    while(distance < d) {
        if(first) {
            G[1].push_back(last), first = 0;
            vis[last] = 1;
        }
        else {
            G[last].push_back(last + 1);
            vis[last] = vis[last + 1] = 1;
            last++;
        }
        distance++;
        depth++;
    }

    if(depth > h) return cout << "-1\n",0;
    for (int i = 1; i <= n; ++i)
        if(!vis[i])
            G[2].push_back(i);
    if(!can(1,0)) return cout << "-1\n",0;

    for (int i = 1; i <= n; ++i)
        for (int x: G[i])
            cout << i << " " << x << "\n";

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,d,h;

vector<int> G[100010];
bool vis[100010];

bool can(int u, int depth) {
    if(depth > h) return 0;
    int ans = 1;
    for (int v: G[u])
        ans &= can(v, depth + 1);
    return ans;
}

int main() {
    cin >> n >> d >> h;
    int last = 1;
    int distance = 0;
    for (int i = 0; i < h; ++i) {
        G[last].push_back(last + 1);
        vis[last] = vis[last + 1] = 1;
        distance++;
        last++;
    }
    int dia = 1;
    last++;
    bool first = 1;
    int depth = 0;
    while(distance < d) {
        if(first) {
            G[1].push_back(last), first = 0;
            vis[last] = 1;
            dia = last;
        }
        else {
            G[last].push_back(last + 1);
            vis[last] = vis[last + 1] = 1;
            dia = last + 1;
            last++;
        }
        distance++;
        depth++;
    }

    if(depth > h) return cout << "-1\n",0;
    for (int i = 1; i <= n; ++i)
        if(!vis[i])  {
            if(h == dia) return cout << "-1\n",0;
            G[h].push_back(i);
        }
    if(!can(1,0)) return cout << "-1\n",0;

    for (int i = 1; i <= n; ++i)
        for (int x: G[i])
            cout << i << " " << x << "\n";

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,d,h;
    cin>>n>>d>>h;
   if(d>2*h||d<h)
    {
    cout<<-1;return 0;

       }
       if(d!=h)
       {for(int i=0;i<h;i++)
       cout<<i+1<<" "<<i+2<<endl;
       for(int i=h;i<d;i++)
       {
           if(i==h)
            cout<<1<<" "<<h+2<<endl;
           else cout<<i+1<<" "<<i+2<<endl;
       }
       for(int i=d;i<n-1;i++)
        cout<<1<<" "<<i+2<<endl;}
        else
         {for(int i=0;i<h-1;i++)
       cout<<i+1<<" "<<i+2<<endl;

       for(int i=h;i<n-1;i++)
        cout<<1<<" "<<i+2<<endl;}

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,d,h;
    cin>>n>>d>>h;
   if((d+1)/2>h)
    {
        cout<<-1;return 0;
    }
    for(int i=0;i<h;i++)
    cout<<i+1<<" "<<i+2<<endl;
    if((d+1)%2==0)
    {for(int i=h;i<n-1;i++)
        cout<<1<<" "<<i+2<<endl;}
       else
       {
           cout<<1<<" "<<h+2<<endl;
          for(int i=h+1;i<n-1;i++)
        cout<<h+2<<" "<<i+2<<endl;

       }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,d,h;
    cin>>n>>d>>h;
   if(d>2*h||d<h)
    {
    cout<<-1;return 0;

       }
       if(d!=h)
       {for(int i=0;i<h;i++)
       cout<<i+1<<" "<<i+2<<endl;
       for(int i=h;i<d;i++)
       {
           if(i==h)
            cout<<1<<" "<<h+2<<endl;
           else cout<<i+1<<" "<<i+2<<endl;
       }
       for(int i=d;i<n-1;i++)
        cout<<1<<" "<<i+2<<endl;}
        else
         {for(int i=0;i<h-1;i++)
       cout<<i+1<<" "<<i+2<<endl;

       for(int i=h;i<=n-1;i++)
        cout<<1<<" "<<i+1<<endl;}

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,d,h;
    cin>>n>>d>>h;
   if((d+1)/2>h||n==d)
    {
        cout<<-1;return 0;
    }
    for(int i=0;i<h;i++)
    cout<<i+1<<" "<<i+2<<endl;
    if((d+1)%2==0)
    {for(int i=h;i<n-1;i++)
        cout<<1<<" "<<i+2<<endl;}
       else
       {
           cout<<1<<" "<<h+2<<endl;
          for(int i=h+1;i<n-1;i++)
        cout<<h+2<<" "<<i+2<<endl;

       }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,d,h;
    cin>>n>>d>>h;
   if((d+1)/2>h)
    {
        cout<<-1;return 0;
    }
    for(int i=0;i<d-h+1;i++)
    cout<<i+1<<" "<<i+2<<endl;
    //if((d+1)%2==0)
    {for(int i=d-h+1;i<n-1;i++)
        cout<<1<<" "<<i+2<<endl;}

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,d,h;
    cin>>n>>d>>h;
   if((d+1)/2>h)
    {
        cout<<-1;return 0;
    }
    for(int i=0;i<h;i++)
    cout<<1<<" "<<i+2<<endl;
    for(int i=h;i<n-1;i++)
        cout<<h+1<<" "<<i+2<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,d,h;
    cin>>n>>d>>h;
   if(d>2*h||d<h)
    {
    cout<<-1;return 0;

       }
       if(d!=h)
       {for(int i=0;i<h;i++)
       cout<<i+1<<" "<<i+2<<endl;
       for(int i=h;i<d;i++)
       {
           if(i==h)
            cout<<1<<" "<<h+2<<endl;
           else cout<<i+1<<" "<<i+2<<endl;
       }
       for(int i=d;i<n-1;i++)
        cout<<1<<" "<<i+2<<endl;}
        else
         {for(int i=0;i<h-1;i++)
       cout<<i+1<<" "<<i+2<<endl;

       for(int i=h;i<=n-1;i++)
        cout<<h<<" "<<i+1<<endl;}

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int n, d, h, cur=1;

int main(){
    scanf("%d%d%d", &n, &d, &h);
    if(d-h > h) return cout << -1 << endl, 0;
    for(int i = 0 ; i < h && n > 1 ; i++){
        cout << cur << " ";
        cout << ++cur << endl;
        n--;
    }
    int x = cur-1;
    cur++; n--;
    if(n){
        if(d == h) cout << x << " " << cur << endl;
        else cout << "1 " << cur << endl;
    }
    for(int i = 1 ; i < d-h && n > 1 ; i++){
        cout << cur << " ";
        cout << ++cur << endl;
        n--;
    }
    cur++;
    for(int i = 1 ; i < n ; i++)
        cout << x << " " << cur++ << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int n, d, h, cur=1;

int main(){
    scanf("%d%d%d", &n, &d, &h);
    if(d-h > h) return cout << -1 << endl, 0;
    if(d == h){
        for(int i = 1 ; i < h ; i++)
            cout << i << " " << i+1 << endl;
        for(int i = h+1 ; i <= n ; i++)
            cout << 1 << " " << i << endl;
        return 0;
    }
    for(int i = 0 ; i < h && n > 1 ; i++){
        cout << cur << " ";
        cout << ++cur << endl;
        n--;
    }
    cur++; n--;
    if(n) cout << "1 " << cur << endl;
    for(int i = 1 ; i < d-h && n > 1 ; i++){
        cout << cur << " ";
        cout << ++cur << endl;
        n--;
    }
    cur++;
    for(int i = 1 ; i < n ; i++)
        cout << "1 " << cur++ << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int n, d, h, cur=1;

int main(){
    scanf("%d%d%d", &n, &d, &h);
    if(d-h > h) return cout << -1 << endl, 0;
    if(d == h){
        for(int i = 1 ; i < h ; i++)
            cout << i << " " << i+1 << endl;
        for(int i = h ; i <= n ; i++)
            if(i-1) cout << 1 << " " << i << endl;
        return 0;
    }
    for(int i = 0 ; i < h && n > 1 ; i++){
        cout << cur << " ";
        cout << ++cur << endl;
        n--;
    }
    cur++; n--;
    if(n) cout << "1 " << cur << endl;
    for(int i = 1 ; i < d-h && n > 1 ; i++){
        cout << cur << " ";
        cout << ++cur << endl;
        n--;
    }
    cur++;
    for(int i = 1 ; i < n ; i++)
        cout << "1 " << cur++ << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int n, d, h, cur=1;

int main(){
    scanf("%d%d%d", &n, &d, &h);
    if(d-h > h) return cout << -1 << endl, 0;
    if(d == h){
        for(int i = 1 ; i < h ; i++)
            cout << i << " " << i+1 << endl;
        for(int i = h ; i <= n ; i++)
            cout << 1 << " " << i << endl;
        return 0;
    }
    for(int i = 0 ; i < h && n > 1 ; i++){
        cout << cur << " ";
        cout << ++cur << endl;
        n--;
    }
    cur++; n--;
    if(n) cout << "1 " << cur << endl;
    for(int i = 1 ; i < d-h && n > 1 ; i++){
        cout << cur << " ";
        cout << ++cur << endl;
        n--;
    }
    cur++;
    for(int i = 1 ; i < n ; i++)
        cout << "1 " << cur++ << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int n, d, h, cur=1;

int main(){
    scanf("%d%d%d", &n, &d, &h);
    if(d-h > h) return cout << -1 << endl, 0;
    for(int i = 0 ; i < h && n > 1 ; i++){
        cout << cur << " ";
        cout << ++cur << endl;
        n--;
    }
    cur++; n--;
    if(n) cout << "1 " << cur+1 << endl;
    for(int i = 1 ; i < d-h && n > 1 ; i++){
        cout << cur << " ";
        cout << ++cur << endl;
        n--;
    }
    cur++;
    for(int i = 1 ; i < n ; i++)
        cout << "1 " << cur++ << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int n, d, h, cur=1;

int main(){
    scanf("%d%d%d", &n, &d, &h);
    if(d-h > h) return cout << -1 << endl, 0;
    for(int i = 0 ; i < h && n > 1 ; i++){
        cout << cur << " ";
        cout << ++cur << endl;
        n--;
    }
    int x = cur-1;
    cur++; n--;
    if(n) cout << "1 " << cur << endl;
    for(int i = 1 ; i < d-h && n > 1 ; i++){
        cout << cur << " ";
        cout << ++cur << endl;
        n--;
    }
    cur++;
    for(int i = 1 ; i < n ; i++)
        cout << x << " " << cur++ << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int n, d, h, cur=1;

int main(){
    scanf("%d%d%d", &n, &d, &h);
    if(d-h > h) return cout << -1 << endl, 0;
    for(int i = 0 ; i < h && n > 1 ; i++){
        cout << cur << " ";
        cout << ++cur << endl;
        n--;
    }
    cur++; n--;
    if(n) cout << "1 " << cur << endl;
    for(int i = 1 ; i < d-h && n > 1 ; i++){
        cout << cur << " ";
        cout << ++cur << endl;
        n--;
    }
    cur++;
    for(int i = 1 ; i < n ; i++)
        cout << "1 " << cur++ << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int n, d, h, cur=1;

int main(){
    scanf("%d%d%d", &n, &d, &h);
    if(d > 2*h || (h == 1 && d == 1 && n > 2)) return cout << -1 << endl, 0;
    for(int i = 0 ; i < h && n > 1 ; i++){
        cout << cur << " ";
        cout << ++cur << endl;
        n--;
    }
    int x = cur-1;
    cur++; n--;
    if(n){
        if(d == h) cout << x << " " << cur << endl;
        else cout << "1 " << cur << endl;
    }
    for(int i = 1 ; i < d-h && n > 1 ; i++){
        cout << cur << " ";
        cout << ++cur << endl;
        n--;
    }
    cur++;
    for(int i = 1 ; i < n ; i++)
        cout << x << " " << cur++ << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int n, d, h, cur=1;

int main(){
    scanf("%d%d%d", &n, &d, &h);
    if(d-h > h) return cout << -1 << endl, 0;
    for(int i = 0 ; i < h-1; i++){
        cout << cur << " ";
        cout << ++cur << endl;
        n--;
    }
    cur++; n--;
    if(n) cout << "1 " << cur << endl;
    for(int i = 1 ; i < d-h && n > 1 ; i++){
        cout << cur << " ";
        cout << ++cur << endl;
        n--;
    }
    cur++;
    for(int i = 1 ; i < n ; i++)
        cout << "1 " << cur++ << endl;
    return 0;
}


#include<iostream>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<stdio.h>
#include<strstream>
#include<memory.h>
#include<set>
#include<stack>
#include<queue>
#include<list>
#include<iomanip>
#include<istream>
#include<sstream>
#include<bitset>
#include<time.h>
#define lp(i,n) for(int i=0;i<n;i++)
#define FIO ios::sync_with_stdio(0)
#define oo 1e7+9
using namespace std;
typedef pair<int,int> ii;
typedef pair<double,double> dd;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef unsigned long long ull;
int main()
{
    int n,d,h;
    cin>>n>>d>>h;
    int i=1;
    if(d>2*h)
    {
        int out=-1;
        cout<<out<<endl;
    }
    else if(n==2)
    {
        if(d==1 && h==1)
            cout<<"1 2"<<endl;
        else
        {
            int out=-1;
            cout<<out<<endl;
        }
    }
    else if(d==h && d==n-1)
    {
        for(; i<=n; i++)
            cout<<i<<" "<<i+1<<endl;
    }
    else if(d==h && d!=n-1)
    {
        for(; i<d; i++)
            cout<<i<<" "<<i+1<<endl;
        i++;
        for(; i<=n; i++)
            cout<<1<<" "<<i<<endl;
    }
    else
    {
        int cnt=0;
        for(i=1; i<=h; i++,cnt++)
            cout<<i<<" "<<i+1<<endl;
        if(cnt<d)
            cout<<1<<" "<<i+1<<endl , cnt++;
        i++;
        for(;cnt<d;cnt++,i++)
            cout<<i<<" "<<i+1<<endl;
        i++;
        for(; i<=n; i++)
            cout<<1<<" "<<i<<endl;
    }
    return 0;
}


#include<iostream>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<stdio.h>
#include<strstream>
#include<memory.h>
#include<set>
#include<stack>
#include<queue>
#include<list>
#include<iomanip>
#include<istream>
#include<sstream>
#include<bitset>
#include<time.h>
#define lp(i,n) for(int i=0;i<n;i++)
#define FIO ios::sync_with_stdio(0)
#define oo 1e7+9
using namespace std;
typedef pair<int,int> ii;
typedef pair<double,double> dd;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef unsigned long long ull;
int main()
{
    int n,d,h;
    cin>>n>>d>>h;
    int i=1;
    if(d>2*h)
    {
        int out=-1;
        cout<<out<<endl;
    }
    else if(n==2)
    {
        if(d==1 && h==1)
            cout<<"1 2"<<endl;
        else
        {
            int out=-1;
            cout<<out<<endl;
        }
    }
    else if(d==h && d==n-1)
    {
        for(; i<=n; i++)
            cout<<i<<" "<<i+1<<endl;
    }
    else if(d==h && d!=n-1)
    {
        for(; i<d; i++)
            cout<<i<<" "<<i+1<<endl;
        i++;
        for(; i<=n; i++)
            cout<<1<<" "<<i<<endl;
    }
    else
    {
        for(i=1; i<=h; i++)
            cout<<i<<" "<<i+1<<endl;
        if(i<d)
            cout<<1<<" "<<i+1<<endl;
        i++;
        for(int j=0; j<=d-i; j++,i++)
            cout<<i<<" "<<i+1<<endl;
        i++;
        for(; i<=n; i++)
            cout<<1<<" "<<i<<endl;
    }
    return 0;
}


#include<iostream>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<stdio.h>
#include<strstream>
#include<memory.h>
#include<set>
#include<stack>
#include<queue>
#include<list>
#include<iomanip>
#include<istream>
#include<sstream>
#include<bitset>
#include<time.h>
#define lp(i,n) for(int i=0;i<n;i++)
#define FIO ios::sync_with_stdio(0)
#define oo 1e7+9
using namespace std;
typedef pair<int,int> ii;
typedef pair<double,double> dd;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef unsigned long long ull;
int main()
{
    int n,d,h,idx=0,vtx=1;
    vector<int>v,rest;
    cin>>n>>d>>h;
    for(int i=0;i<=d/2;i++)
        v.push_back(vtx) , vtx++;
    v.push_back(0);
    for(int i=d/2+1;i<d;i++)
        v.push_back(vtx) , vtx++;
    for(int i=vtx;i<n;i++)
        rest.push_back(i);
    if((d)>2*h || vtx>n)
    {
        int out=-1;
        cout<<out<<endl;
    }
    else
    {
  for(int i=0;i<v.size()-1;i++)
        cout<<v[i]+1<<" "<<v[i+1]+1<<endl;
    for(int i=0;i<rest.size();i++)
        cout<<1<<" "<<rest[i]+1<<endl;
    }
    return 0;
}


#include<iostream>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<stdio.h>
#include<strstream>
#include<memory.h>
#include<set>
#include<stack>
#include<queue>
#include<list>
#include<iomanip>
#include<istream>
#include<sstream>
#include<bitset>
#include<time.h>
#define lp(i,n) for(int i=0;i<n;i++)
#define FIO ios::sync_with_stdio(0)
#define oo 1e7+9
using namespace std;
typedef pair<int,int> ii;
typedef pair<double,double> dd;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef unsigned long long ull;
int main()
{
    int n,d,h,idx=0,vtx=1;
    vector<int>v,rest;
    cin>>n>>d>>h;
    for(int i=0;i<d/2;i++)
        v.push_back(vtx) , vtx++;
    v.push_back(0);
    for(int i=d/2;i<d;i++)
        v.push_back(vtx) , vtx++;
    for(int i=vtx;i<n;i++)
        rest.push_back(i);
    if((d)>2*h || vtx>n)
    {
        int out=-1;
        cout<<out<<endl;
    }
    else
    {
  for(int i=0;i<v.size()-1;i++)
        cout<<v[i]+1<<" "<<v[i+1]+1<<endl;
    for(int i=0;i<rest.size();i++)
        cout<<1<<" "<<rest[i]+1<<endl;
    }
    return 0;
}


#include<iostream>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<stdio.h>
#include<strstream>
#include<memory.h>
#include<set>
#include<stack>
#include<queue>
#include<list>
#include<iomanip>
#include<istream>
#include<sstream>
#include<bitset>
#include<time.h>
#define lp(i,n) for(int i=0;i<n;i++)
#define FIO ios::sync_with_stdio(0)
#define oo 1e7+9
using namespace std;
typedef pair<int,int> ii;
typedef pair<double,double> dd;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef unsigned long long ull;
int main()
{
    int n,d,h,idx=0,vtx=1;
    vector<int>v,rest;
    cin>>n>>d>>h;
    for(int i=0;i<=d/2;i++)
        v.push_back(vtx) , vtx++;
    v.push_back(0);
    for(int i=d/2+2;i<d;i++)
        v.push_back(vtx) , vtx++;
    for(int i=vtx;i<n;i++)
        rest.push_back(i);
    if((d)>2*h || vtx>n)
    {
        int out=-1;
        cout<<out<<endl;
    }
    else
    {
  for(int i=0;i<v.size()-1;i++)
        cout<<v[i]+1<<" "<<v[i+1]+1<<endl;
    for(int i=0;i<rest.size();i++)
        cout<<1<<" "<<rest[i]+1<<endl;
    }
    return 0;
}


#include<iostream>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<stdio.h>
#include<strstream>
#include<memory.h>
#include<set>
#include<stack>
#include<queue>
#include<list>
#include<iomanip>
#include<istream>
#include<sstream>
#include<bitset>
#include<time.h>
#define lp(i,n) for(int i=0;i<n;i++)
#define FIO ios::sync_with_stdio(0)
#define oo 1e7+9
using namespace std;
typedef pair<int,int> ii;
typedef pair<double,double> dd;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef unsigned long long ull;
int main()
{
    int n,d,h;
    cin>>n>>d>>h;
    int i=1;
    if(d>2*h)
    {
        int out=-1;
        cout<<out<<endl;
    }
    else if(n==2)
    {
        if(d==1 && h==1)
            cout<<"1 2"<<endl;
        else
        {
            int out=-1;
            cout<<out<<endl;
        }
    }
    else if(d==h && d==n-1)
    {
        for(; i<=n; i++)
            cout<<i<<" "<<i+1<<endl;
    }
    else if(d==h && d!=n-1)
    {
        for(; i<=d; i++)
            cout<<i<<" "<<i+1<<endl;
        i++;
        for(; i<=n; i++)
            cout<<2<<" "<<i<<endl;
    }
    else
    {
        int cnt=0;
        for(i=1; i<=h; i++,cnt++)
            cout<<i<<" "<<i+1<<endl;
        if(cnt<d)
            cout<<1<<" "<<i+1<<endl , cnt++;
        i++;
        for(;cnt<d;cnt++,i++)
            cout<<i<<" "<<i+1<<endl;
        i++;
        for(; i<=n; i++)
            cout<<1<<" "<<i<<endl;
    }
    return 0;
}


#include<iostream>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<stdio.h>
#include<strstream>
#include<memory.h>
#include<set>
#include<stack>
#include<queue>
#include<list>
#include<iomanip>
#include<istream>
#include<sstream>
#include<bitset>
#include<time.h>
#define lp(i,n) for(int i=0;i<n;i++)
#define FIO ios::sync_with_stdio(0)
#define oo 1e7+9
using namespace std;
typedef pair<int,int> ii;
typedef pair<double,double> dd;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef unsigned long long ull;
int main()
{
    int n,d,h;
    cin>>n>>d>>h;
    int i=1;
    if(d>2*h)
    {
        int out=-1;
        cout<<out<<endl;
    }
    else if(n==2)
    {
        if(d==1 && h==1)
            cout<<"1 2"<<endl;
    }
    else if((d==1 && h==1)&&(n!=2)){
            int out=-1;
            cout<<out<<endl;
        }
    else if(d==h && d==n-1)
    {
        for(; i<=n; i++)
            cout<<i<<" "<<i+1<<endl;
    }
    else if(d==h && d!=n-1)
    {
        for(; i<=d; i++)
            cout<<i<<" "<<i+1<<endl;
        i++;
        for(; i<=n; i++)
            cout<<2<<" "<<i<<endl;
    }
    else
    {
        int cnt=0;
        for(i=1; i<=h; i++,cnt++)
            cout<<i<<" "<<i+1<<endl;
        if(cnt<d)
            cout<<1<<" "<<i+1<<endl , cnt++;
        i++;
        for(;cnt<d;cnt++,i++)
            cout<<i<<" "<<i+1<<endl;
        i++;
        for(; i<=n; i++)
            cout<<1<<" "<<i<<endl;
    }
    return 0;
}


#include<iostream>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<stdio.h>
#include<strstream>
#include<memory.h>
#include<set>
#include<stack>
#include<queue>
#include<list>
#include<iomanip>
#include<istream>
#include<sstream>
#include<bitset>
#include<time.h>
#define lp(i,n) for(int i=0;i<n;i++)
#define FIO ios::sync_with_stdio(0)
#define oo 1e7+9
using namespace std;
typedef pair<int,int> ii;
typedef pair<double,double> dd;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef unsigned long long ull;
int main()
{
    int n,d,h;
    cin>>n>>d>>h;
    int i=1;
    if(d>2*h)
    {
        int out=-1;
        cout<<out<<endl;
    }
    else if(n==2)
    {
        if(d==1 && h==1)
            cout<<"1 2"<<endl;
        else
        {
            int out=-1;
            cout<<out<<endl;
        }
    }
    else if(d==h && d==n-1)
    {
        for(; i<=n; i++)
            cout<<i<<" "<<i+1<<endl;
    }
    else if(d==h && d!=n-1)
    {
        for(; i<d; i++)
            cout<<i<<" "<<i+1<<endl;
        i++;
        for(; i<=n; i++)
            cout<<1<<" "<<i<<endl;
    }
    else
    {
        for(i=1; i<=h; i++)
            cout<<i<<" "<<i+1<<endl;
        if(i<d)
            cout<<1<<" "<<i+1<<endl;
        i++;
        for(int j=0; j<=d-i; j++,i++)
            cout<<i<<" "<<i+1<<endl;
        for(; i<=n; i++)
            cout<<1<<" "<<i<<endl;
    }
    return 0;
}


#include<iostream>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<stdio.h>
#include<strstream>
#include<memory.h>
#include<set>
#include<stack>
#include<queue>
#include<list>
#include<iomanip>
#include<istream>
#include<sstream>
#include<bitset>
#include<time.h>
#define lp(i,n) for(int i=0;i<n;i++)
#define FIO ios::sync_with_stdio(0)
#define oo 1e7+9
using namespace std;
typedef pair<int,int> ii;
typedef pair<double,double> dd;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef unsigned long long ull;
int main()
{
    int n,d,h,idx=0,vtx=1;
    vector<int>v,rest;
    cin>>n>>d>>h;
    for(int i=0;i<=d/2;i++)
        v.push_back(vtx) , vtx++;
    v.push_back(0);
    for(int i=d/2+1;i<d;i++)
        v.push_back(vtx) , vtx++;
    for(int i=vtx;i<n;i++)
        rest.push_back(i);
    if((d)>2*h)
    {
        int out=-1;
        cout<<out<<endl;
    }
    else{
  for(int i=0;i<v.size()-1;i++)
        cout<<v[i]+1<<" "<<v[i+1]+1<<endl;
    for(int i=0;i<rest.size();i++)
        cout<<1<<" "<<rest[i]+1<<endl;
    }
    return 0;
}


#include<iostream>
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<stdio.h>
#include<strstream>
#include<memory.h>
#include<set>
#include<stack>
#include<queue>
#include<list>
#include<iomanip>
#include<istream>
#include<sstream>
#include<bitset>
#include<time.h>
#define lp(i,n) for(int i=0;i<n;i++)
#define FIO ios::sync_with_stdio(0)
#define oo 1e7+9
using namespace std;
typedef pair<int,int> ii;
typedef pair<double,double> dd;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef unsigned long long ull;
int main()
{
    //life sucks
    int n,d,h;
    cin>>n>>d>>h;
    int i=1;
    if(d>2*h)
    {
        int out=-1;
        cout<<out<<endl;
    }
    else if(n==2)
    {
        if(d==1 && h==1)
            cout<<"1 2"<<endl;
    }
    else if((d==1 && h==1)&&(n!=2)){
            int out=-1;
            cout<<out<<endl;
        }
    else if(d==h && d==n-1)
    {
        for(; i<n; i++)
            cout<<i<<" "<<i+1<<endl;
    }
    else if(d==h && d!=n-1)
    {
        for(; i<=d; i++)
            cout<<i<<" "<<i+1<<endl;
        i++;
        for(; i<=n; i++)
            cout<<2<<" "<<i<<endl;
    }
    else
    {
        int cnt=0;
        for(i=1; i<=h; i++,cnt++)
            cout<<i<<" "<<i+1<<endl;
        if(cnt<d)
            cout<<1<<" "<<i+1<<endl , cnt++;
        i++;
        for(;cnt<d;cnt++,i++)
            cout<<i<<" "<<i+1<<endl;
        i++;
        for(; i<=n; i++)
            cout<<1<<" "<<i<<endl;
    }
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <sstream>
#include <set>
#include <iomanip>
#include <list>
#include <stack>
#include <queue>
#include <bitset>
#include <numeric>
#include <functional>

#include <cstdio>
#include <cmath>
#include <climits>
#include <cstring>
#include <cctype>
#include <cstdlib>

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define rep(i, n)       for(int i = 0; i < n; i++)
#define reps(i, a, n)   for(int i = a; i < n; i++)
#define precout(a,b)    cout << fixed << setprecision((b)) << (a)
#define endl 			'\n'
#define pb              push_back
#define mp              make_pair
#define ff              first
#define ss              second
#define all(a)          a.begin(), a.end()
#define rall(a)			a.rbegin(), a.rend()
#define sz(x)			(int)x.size()
#define fastIO   		ios::sync_with_stdio(false); cin.tie(0);

const int maxx = 1e5 + 9;
vi graph[maxx];

int main(){
#ifndef ONLINE_JUDGE
    const clock_t begin_time = clock();
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif

    fastIO

    int n, d, h;
    cin >> n >> d >> h;
    if (n == 2) {
        if ( d > 1 && h > 1) cout << -1 << endl;
        else cout << 1 << " " << 2 << endl;
    } else if (d >  2 * h || d > n || (d == 1 && n >= 3))
        cout << -1 << endl;
    else {

        if (d == h) {
            int i;
            for (i = 1; i <= h; i++)
                cout << i << " " << i + 1 << endl;

            while (i < n) {
                cout << 2 << " " << i + 1 << endl;
                i++;
            }
        } else {
            int i;
            for (i = 1; i <= h; i++) {
                cout << i << " " << i + 1 << endl;
            }

            int ih = d - h;
            int c;
            for (c = i + 1; c < ih; c++)
                cout << 1 << " " << c << endl;
            while (c < n) {
                cout << 1 << " " << c + 1 << endl;
                c++;
            }
        }

    }

#ifndef ONLINE_JUDGE
   	cout << endl;
    cout << "Time : ";
    cout << float( clock () - begin_time ) / CLOCKS_PER_SEC << endl;
#endif

    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <sstream>
#include <set>
#include <iomanip>
#include <list>
#include <stack>
#include <queue>
#include <bitset>
#include <numeric>
#include <functional>

#include <cstdio>
#include <cmath>
#include <climits>
#include <cstring>
#include <cctype>
#include <cstdlib>

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define rep(i, n)       for(int i = 0; i < n; i++)
#define reps(i, a, n)   for(int i = a; i < n; i++)
#define precout(a,b)    cout << fixed << setprecision((b)) << (a)
#define endl 			'\n'
#define pb              push_back
#define mp              make_pair
#define ff              first
#define ss              second
#define all(a)          a.begin(), a.end()
#define rall(a)			a.rbegin(), a.rend()
#define sz(x)			(int)x.size()
#define fastIO   		ios::sync_with_stdio(false); cin.tie(0);

const int maxx = 1e5 + 9;
vi graph[maxx];

int main(){
#ifndef ONLINE_JUDGE
    const clock_t begin_time = clock();
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif

    fastIO

    int n, d, h;
    cin >> n >> d >> h;
    if (n == 2) {
        if ( d > 1 && h > 1) cout << -1 << endl;
        else cout << 1 << " " << 2 << endl;
    } else if (d >  2 * h || d > n || (d == 1 && n >= 3))
        cout << -1 << endl;
    else {

        if (d == h) {
            int i;
            for (i = 1; i <= h; i++)
                cout << i << " " << i + 1 << endl;

            while (i < n) {
                cout << 2 << " " << i + 1 << endl;
                i++;
            }
        } else {
            int i;
            for (i = 1; i <= h; i++) {
                cout << i << " " << i + 1 << endl;
            }

            int ih = d - h;
            int c;
            for (c = i ; c < ih; c++)
                cout << 1 << " " << c << endl;
            while (c < n) {
                cout << 1 << " " << c + 1 << endl;
                c++;
            }
        }

    }

#ifndef ONLINE_JUDGE
   	cout << endl;
    cout << "Time : ";
    cout << float( clock () - begin_time ) / CLOCKS_PER_SEC << endl;
#endif

    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <sstream>
#include <set>
#include <iomanip>
#include <list>
#include <stack>
#include <queue>
#include <bitset>
#include <numeric>
#include <functional>

#include <cstdio>
#include <cmath>
#include <climits>
#include <cstring>
#include <cctype>
#include <cstdlib>

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define rep(i, n)       for(int i = 0; i < n; i++)
#define reps(i, a, n)   for(int i = a; i < n; i++)
#define precout(a,b)    cout << fixed << setprecision((b)) << (a)
#define endl 			'\n'
#define pb              push_back
#define mp              make_pair
#define ff              first
#define ss              second
#define all(a)          a.begin(), a.end()
#define rall(a)			a.rbegin(), a.rend()
#define sz(x)			(int)x.size()
#define fastIO   		ios::sync_with_stdio(false); cin.tie(0);

const int maxx = 1e5 + 9;
vi graph[maxx];

int main(){
#ifndef ONLINE_JUDGE
    const clock_t begin_time = clock();
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif

    fastIO

    int n, d, h;
    cin >> n >> d >> h;
    if (d > 2 * h) {
        cout << -1 << endl;
        return 0;
    }

    int id = 0;
    int l = 1, r = 1;
    int ih = 0;
    map<int, bool> vis;
    vis[1] = true;
    for (int i = 2; i <= n && id <= d;) {
        bool check = false;
        if (id + 1 <= d) {
            graph[l].pb(i);
            vis[i] = true;
            id++;
            l = i;

          //  cout << l << endl;
            i++;
            check = true;
        }
        if (id + 1 <= d) {
            graph[r].pb(i);
            vis[i] = true;
            id++;
            r = i;
            i++;
           // cout << r << endl;

            check = true;
        }
        ih++;
        if (not check) break;
    }
    int c = 1;
    for(int i = 1; i <= n; i++){
        if (!vis[i]) {
            c = i;
            break;
        }
    }
    int pre = c - 1;
    int nxt = c;
   // cout << pre << " " << nxt << endl;
    while (ih <= h) {
        graph[pre].pb(nxt);
        pre = nxt;
        nxt++;
        ih++;
    }

   // cout << pre << " " << nxt << endl;

    while (nxt <= n) {
        graph[1].pb(nxt);
        nxt++;
    }

    for (int i = 1; i <= n; i++) {
        for (auto x : graph[i])
            cout << i << " " << x << endl;
    }
#ifndef ONLINE_JUDGE
   	cout << endl;
    cout << "Time : ";
    cout << float( clock () - begin_time ) / CLOCKS_PER_SEC << endl;
#endif

    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <sstream>
#include <set>
#include <iomanip>
#include <list>
#include <stack>
#include <queue>
#include <bitset>
#include <numeric>
#include <functional>

#include <cstdio>
#include <cmath>
#include <climits>
#include <cstring>
#include <cctype>
#include <cstdlib>

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define rep(i, n)       for(int i = 0; i < n; i++)
#define reps(i, a, n)   for(int i = a; i < n; i++)
#define precout(a,b)    cout << fixed << setprecision((b)) << (a)
#define endl 			'\n'
#define pb              push_back
#define mp              make_pair
#define ff              first
#define ss              second
#define all(a)          a.begin(), a.end()
#define rall(a)			a.rbegin(), a.rend()
#define sz(x)			(int)x.size()
#define fastIO   		ios::sync_with_stdio(false); cin.tie(0);

const int maxx = 1e5 + 9;
vi graph[maxx];

int main(){
#ifndef ONLINE_JUDGE
    const clock_t begin_time = clock();
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif

    fastIO

    int n, d, h;
    cin >> n >> d >> h;
    if (n == 2) {
        if ( d > 1 && h > 1) cout << -1 << endl;
        else cout << 1 << " " << 2 << endl;
    } else if (d >  2 * h || d > n || (d == 1 && n >= 3))
        cout << -1 << endl;
    else {

        if (d == h) {
            int i;
            for (i = 1; i <= h; i++)
                cout << i << " " << i + 1 << endl;

            while (i < n) {
                cout << 2 << " " << i + 1 << endl;
                i++;
            }
        } else {
            int i;
            int ih = h;
            for (i = 1; ih ; i++) {
                cout << i << " " << i + 1 << endl;
                ih--;
            }

            int id = d - h - 1;
            cout << 1 << " " << ++i << endl;

            while(id--) {
                cout << i << " " << i + 1 << endl;
                i++;
            }

            while (i + 1 <= n)
                cout << 1 << " " << ++i << endl;
        }

    }

#ifndef ONLINE_JUDGE
   	cout << endl;
    cout << "Time : ";
    cout << float( clock () - begin_time ) / CLOCKS_PER_SEC << endl;
#endif

    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <sstream>
#include <set>
#include <iomanip>
#include <list>
#include <stack>
#include <queue>
#include <bitset>
#include <numeric>
#include <functional>

#include <cstdio>
#include <cmath>
#include <climits>
#include <cstring>
#include <cctype>
#include <cstdlib>

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define rep(i, n)       for(int i = 0; i < n; i++)
#define reps(i, a, n)   for(int i = a; i < n; i++)
#define precout(a,b)    cout << fixed << setprecision((b)) << (a)
#define endl 			'\n'
#define pb              push_back
#define mp              make_pair
#define ff              first
#define ss              second
#define all(a)          a.begin(), a.end()
#define rall(a)			a.rbegin(), a.rend()
#define sz(x)			(int)x.size()
#define fastIO   		ios::sync_with_stdio(false); cin.tie(0);

const int maxx = 1e5 + 9;
vi graph[maxx];

int n, d, h;
int main(){
#ifndef ONLINE_JUDGE
    const clock_t begin_time = clock();
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif

    fastIO

    cin >> n >> d >> h;
    if (d > min(n, 2 * h)) {
        cout << -1 << endl;
        return 0;
    }

    if (h == d) {
        for (int i = 1; i <= h; i++)
            cout << i << " " << i + 1 << endl;

        for (int i = h + 2; i <= n; i++)
            cout << 2 << " " << i << endl;

    }
    else {
        for (int i = 1; i <= h; i++)
            cout << i << " " << i + 1 << endl;

        cout << 1 << " " << h + 2 << endl;

        for (int i = h + 2; i <= d; i++)
            cout << i << " " << i + 1 << endl;

        for (int i = d + 2; i <= n; i++)
            cout << 1 << " " << i << endl;

    }
#ifndef ONLINE_JUDGE
   	cout << endl;
    cout << "Time : ";
    cout << float( clock () - begin_time ) / CLOCKS_PER_SEC << endl;
#endif

    return 0;
}