You are given $n$ words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.

Each lyric consists of two lines. Each line consists of two words separated by whitespace. 

A lyric is beautiful if and only if it satisfies all conditions below.   The number of vowels in the first word of the first line is the same as the number of vowels in the first word of the second line.  The number of vowels in the second word of the first line is the same as the number of vowels in the second word of the second line.  The last vowel of the first line is the same as the last vowel of the second line. Note that there may be consonants after the vowel. 

Also, letters "a", "e", "o", "i", and "u" are vowels. Note that "y" is never vowel.

For example of a beautiful lyric,  "hello hellooowww" 

"whatsup yowowowow"  is a beautiful lyric because there are two vowels each in "hello" and "whatsup", four vowels each in "hellooowww" and "yowowowow" (keep in mind that "y" is not a vowel), and the last vowel of each line is "o".

For example of a not beautiful lyric,  "hey man"

"iam mcdic"  is not a beautiful lyric because "hey" and "iam" don't have same number of vowels and the last vowels of two lines are different ("a" in the first and "i" in the second).

How many beautiful lyrics can you write from given words? Note that you cannot use a word more times than it is given to you. For example, if a word is given three times, you can use it at most three times.


-----Input-----

The first line contains single integer $n$ ($1 \le n \le 10^{5}$) — the number of words.

The $i$-th of the next $n$ lines contains string $s_{i}$ consisting lowercase alphabet letters — the $i$-th word. It is guaranteed that the sum of the total word length is equal or less than $10^{6}$. Each word contains at least one vowel.


-----Output-----

In the first line, print $m$ — the number of maximum possible beautiful lyrics.

In next $2m$ lines, print $m$ beautiful lyrics (two lines per lyric).

If there are multiple answers, print any.


-----Examples-----
Input
14
wow
this
is
the
first
mcdics
codeforces
round
hooray
i
am
proud
about
that

Output
3
about proud
hooray round
wow first
this is
i that
mcdics am

Input
7
arsijo
suggested
the
idea
for
this
problem

Output
0

Input
4
same
same
same
differ

Output
1
same differ
same same



-----Note-----

In the first example, those beautiful lyrics are one of the possible answers. Let's look at the first lyric on the sample output of the first example. "about proud hooray round" forms a beautiful lyric because "about" and "hooray" have same number of vowels, "proud" and "round" have same number of vowels, and both lines have same last vowel. On the other hand, you cannot form any beautiful lyric with the word "codeforces".

In the second example, you cannot form any beautiful lyric from given words.

In the third example, you can use the word "same" up to three times.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: String algorithms

Data structures

Greedy algorithms


Solutions:
def count_vowels(s):
	return sum((1 if c in {'a', 'e', 'i', 'o', 'u'} else 0 for c in s))

def last_vowel(s):
	answer = s[0]
	for c in s:
		if c in {'a', 'e', 'i', 'o', 'u'}:
			answer = c
	return answer
n = int(input())
ss = [input() for _ in range(n)]
d = {}
for s in ss:
	(c, l) = (count_vowels(s), last_vowel(s))
	if (c, l) not in d:
		d[c, l] = []
	d[c, l].append(s)
p2 = []
for (c, l) in d:
	ldcl = len(d[c, l])
	while ldcl > 1:
		p2.append((d[c, l][-2], d[c, l][-1]))
		d[c, l].pop()
		d[c, l].pop()
		ldcl -= 2
p1 = []
d2 = {}
for (c, l) in d:
	if len(d[c, l]) > 0:
		if c not in d2:
			d2[c] = []
		d2[c].append(d[c, l][0])
for c in d2:
	ld2c = len(d2[c])
	while ld2c > 1:
		p1.append((d2[c][-2], d2[c][-1]))
		d2[c].pop()
		d2[c].pop()
		ld2c -= 2
pp = []
(lp1, lp2) = (len(p1), len(p2))
while lp1 > 0 and lp2 > 0:
	pp.append(((p1[-1][0], p2[-1][0]), (p1[-1][1], p2[-1][1])))
	p1.pop()
	p2.pop()
	lp1 -= 1
	lp2 -= 1
while lp2 > 1:
	pp.append(((p2[-2][0], p2[-1][0]), (p2[-2][1], p2[-1][1])))
	p2.pop()
	p2.pop()
	lp2 -= 2
print(len(pp))
for ((a, b), (c, d)) in pp:
	print(f'{a} {b}\n{c} {d}')


import sys
from collections import defaultdict
vowel = set([ord(x) for x in ('a', 'e', 'i', 'o', 'u')])
D = {v: i for (i, v) in enumerate([ord(x) for x in ('a', 'e', 'i', 'o', 'u')])}
N = int(input())
A = defaultdict(list)
B = defaultdict(list)
geta = 10
I = [sys.stdin.readline().strip() for _ in range(N)]
for (i, S) in enumerate(I):
	S = [ord(x) for x in S]
	p = None
	c = 0
	for s in S[::-1]:
		if s in vowel:
			if p is None:
				p = D[s]
			c += 1
	A[c * geta + p].append(i)
	B[c].append(i)
SA = sum((len(v) // 2 for v in A.values()))
SB = sum((len(v) // 2 for v in B.values()))
CA = []
CB = []
used = set()
for v in A.values():
	for i in range(0, len(v) - 1, 2):
		CA.append((v[i], v[i + 1]))
		used.add(v[i])
		used.add(v[i + 1])
for v in B.values():
	fill = True
	T = None
	for i in v:
		if i not in used:
			fill = not fill
			if fill:
				CB.append((T, i))
			else:
				T = i
ans = min(SA, SB // 2)
print(ans)
f = min(len(CA), len(CB))
for i in range(f):
	(a, b) = CA.pop()
	(c, d) = CB.pop()
	print(I[c], I[a])
	print(I[d], I[b])
for _ in range(ans - f):
	(a, b) = CA.pop()
	(c, d) = CA.pop()
	print(I[c], I[a])
	print(I[d], I[b])


vowels = 'aeiou'
n = int(input())
s = []
for i in range(n):
	s.append(input())

def id(word):
	vowel_count = 0
	for letter in word:
		if letter in vowels:
			vowel_count += 1
			last_vowel = letter
	return (vowel_count, last_vowel)
rhymer = {}
for word in s:
	(vowel_count, last_vowel) = id(word)
	if not rhymer.get(vowel_count):
		rhymer[vowel_count] = {}
	if not rhymer[vowel_count].get(last_vowel):
		rhymer[vowel_count][last_vowel] = []
	rhymer[vowel_count][last_vowel].append(word)
(solid_rhymes, weak_rhymes) = ([], [])
for vowel_count in rhymer:
	weak_cache = []
	for last_vowel in rhymer[vowel_count]:
		while len(rhymer[vowel_count][last_vowel]) > 1:
			solid_rhymes.append(rhymer[vowel_count][last_vowel][-2:])
			rhymer[vowel_count][last_vowel].pop()
			rhymer[vowel_count][last_vowel].pop()
		weak_cache += rhymer[vowel_count][last_vowel]
	while len(weak_cache) > 1:
		weak_rhymes.append(weak_cache[-2:])
		weak_cache.pop()
		weak_cache.pop()
while len(solid_rhymes) > len(weak_rhymes):
	weak_rhymes.append(solid_rhymes.pop())

def print_lyric(solid_rhyme, weak_rhyme):
	for j in range(2):
		print(weak_rhyme[j] + ' ' + solid_rhyme[j])
m = len(solid_rhymes)
print(m)
for i in range(m):
	print_lyric(solid_rhymes[i], weak_rhymes[i])


n = int(input())
dic = {}
vowel = {'a': 1, 'e': 2, 'i': 3, 'o': 4, 'u': 5}
first_pair = []
second_pair = []
for i in range(n):
	tmp = input()
	first_vowel = ''
	cnt = 0
	for j in range(len(tmp) - 1, -1, -1):
		if tmp[j] in vowel:
			if first_vowel == '':
				first_vowel = tmp[j]
			cnt += 1
	if str(cnt) + first_vowel not in dic:
		dic[str(cnt) + first_vowel] = tmp
	else:
		second_pair.append([tmp, dic.pop(str(cnt) + first_vowel)])
dic_cnt = {}
for i in dic.keys():
	if int(i[:-1]) not in dic_cnt:
		dic_cnt[int(i[:-1])] = 1
	else:
		dic_cnt[int(i[:-1])] += 1
for i in dic_cnt.keys():
	cnt = 0
	tmp = ''
	if dic_cnt[i] // 2 == 1:
		for j in vowel.keys():
			if str(i) + j in dic:
				if cnt % 2 == 0:
					tmp = dic[str(i) + j]
					cnt += 1
				else:
					first_pair.append([tmp, dic[str(i) + j]])
					cnt += 1
			if cnt == 2:
				break
	elif dic_cnt[i] // 2 == 2:
		for j in vowel.keys():
			if str(i) + j in dic:
				if cnt % 2 == 0:
					tmp = dic[str(i) + j]
					cnt += 1
				else:
					first_pair.append([tmp, dic[str(i) + j]])
					cnt += 1
			if cnt == 4:
				break
len1 = len(first_pair)
len2 = len(second_pair)
if len1 >= len2:
	if len2 == 0:
		print(len2)
	else:
		print(len2)
		for i in range(len2):
			print(first_pair[i][0], second_pair[i][0])
			print(first_pair[i][1], second_pair[i][1])
elif len2 <= 1:
	print(0)
else:
	print(len1 + (len2 - len1) // 2)
	for i in range(len1):
		print(first_pair[i][0], second_pair[i][0])
		print(first_pair[i][1], second_pair[i][1])
	for i in range(len1, len2, 2):
		if (len2 - len1) % 2 == 1:
			if len2 - i == 1:
				break
		print(second_pair[i][0], second_pair[i + 1][0])
		print(second_pair[i][1], second_pair[i + 1][1])


def naiveSolve():
	return
from collections import defaultdict
vowels = {'a', 'e', 'i', 'o', 'u'}

def main():
	n = int(input())
	words = []
	for _ in range(n):
		words.append(input())
	lD = defaultdict(lambda : set())
	lVD = defaultdict(lambda : set())
	length = [-1] * n
	for i in range(n):
		vCnt = 0
		lastV = None
		for c in words[i]:
			if c in vowels:
				vCnt += 1
				lastV = c
		lD[vCnt].add(i)
		lVD[vCnt, lastV].add(i)
		length[i] = vCnt
	lastPairs = []
	for (k, v) in lVD.items():
		(length, lastV) = k
		arr = list(v)
		m = len(arr) // 2 * 2
		for i in range(0, m, 2):
			lastPairs.append((arr[i], arr[i + 1]))
			lD[length].remove(arr[i])
			lD[length].remove(arr[i + 1])
	firstPairs = []
	for (k, v) in lD.items():
		arr = list(v)
		m = len(arr) // 2 * 2
		for i in range(0, m, 2):
			firstPairs.append((arr[i], arr[i + 1]))
	while len(lastPairs) > len(firstPairs):
		firstPairs.append(lastPairs.pop())
	lyricCnts = min(len(firstPairs), len(lastPairs))
	ans = []
	for i in range(lyricCnts):
		ans.append([firstPairs[i][0], lastPairs[i][0]])
		ans.append([firstPairs[i][1], lastPairs[i][1]])
	print(lyricCnts)
	ans2 = []
	for i in range(lyricCnts * 2):
		ans2.append((words[j] for j in ans[i]))
	multiLineArrayOfArraysPrint(ans2)
	return
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]

def makeArr(defaultValFactory, dimensionArr):
	dv = defaultValFactory
	da = dimensionArr
	if len(da) == 1:
		return [dv() for _ in range(da[0])]
	else:
		return [makeArr(dv, da[1:]) for _ in range(da[0])]

def queryInteractive(r):
	print('? {}'.format(r))
	sys.stdout.flush()
	return readIntArr()

def answerInteractive(adj, n):
	print('!')
	for u in range(1, n + 1):
		for v in adj[u]:
			if v > u:
				print('{} {}'.format(u, v))
	sys.stdout.flush()
inf = float('inf')
MOD = 10 ** 9 + 7
from math import gcd, floor, ceil
for _abc in range(1):
	main()


vowelList = ['a', 'e', 'i', 'o', 'u']
r = int(input())
stringArr = []
for i in range(r):
	string = input()
	properties = []
	properties.append(string)
	backStr = string[::-1]
	numVowel = 0
	for j in range(len(string)):
		if backStr[j] in vowelList:
			if numVowel == 0:
				properties.append(backStr[j])
			numVowel += 1
	properties.append(numVowel)
	stringArr.append(properties)
stringArr.sort(key=lambda arr: arr[2])
n = 1
left = 0
equalNumVowels = []
correspondingSecondPairs = []
correspondingFirstPairs = []
currentArr = []
for i in range(r):
	if stringArr[i][2] > n:
		equalNumVowels.append(currentArr)
		n = stringArr[i][2]
		currentArr = []
	currentArr.append(stringArr[i])
equalNumVowels.append(currentArr)
for ar in equalNumVowels:
	aArr = []
	eArr = []
	iArr = []
	oArr = []
	uArr = []
	for item in ar:
		if item[1] == 'a':
			aArr.append(item)
		elif item[1] == 'e':
			eArr.append(item)
		elif item[1] == 'i':
			iArr.append(item)
		elif item[1] == 'o':
			oArr.append(item)
		else:
			uArr.append(item)
	while len(aArr) > 1:
		m = aArr.pop()
		n = aArr.pop()
		correspondingSecondPairs.append([m, n])
	while len(eArr) > 1:
		m = eArr.pop()
		n = eArr.pop()
		correspondingSecondPairs.append([m, n])
	while len(iArr) > 1:
		m = iArr.pop()
		n = iArr.pop()
		correspondingSecondPairs.append([m, n])
	while len(oArr) > 1:
		m = oArr.pop()
		n = oArr.pop()
		correspondingSecondPairs.append([m, n])
	while len(uArr) > 1:
		m = uArr.pop()
		n = uArr.pop()
		correspondingSecondPairs.append([m, n])
	leftOver = []
	if len(aArr) == 1:
		leftOver.append(aArr[0])
	if len(eArr) == 1:
		leftOver.append(eArr[0])
	if len(iArr) == 1:
		leftOver.append(iArr[0])
	if len(oArr) == 1:
		leftOver.append(oArr[0])
	if len(uArr) == 1:
		leftOver.append(uArr[0])
	while len(leftOver) > 1:
		m = leftOver.pop()
		n = leftOver.pop()
		correspondingFirstPairs.append([m, n])
print(min(len(correspondingSecondPairs), len(correspondingFirstPairs) + (len(correspondingSecondPairs) - len(correspondingFirstPairs)) // 2))
while len(correspondingFirstPairs) >= 1 and len(correspondingSecondPairs) >= 1:
	a = correspondingFirstPairs.pop()
	b = correspondingSecondPairs.pop()
	print(str(a[0][0]) + ' ' + str(b[0][0]) + '\n' + str(a[1][0]) + ' ' + str(b[1][0]))
while len(correspondingSecondPairs) >= 2:
	a = correspondingSecondPairs.pop()
	b = correspondingSecondPairs.pop()
	print(str(a[0][0]) + ' ' + str(b[0][0]) + '\n' + str(a[1][0]) + ' ' + str(b[1][0]))


def countVowels(s):
	vowels = ['a', 'e', 'i', 'o', 'u']
	count = 0
	for i in range(len(s)):
		if s[i] in vowels:
			count += 1
			lastVowel = s[i]
	return (count, lastVowel)
n = int(input())
d = {}
second = []
for i in range(n):
	word = input()
	x = countVowels(word)
	if x[0] in d:
		v = d[x[0]]
		if x[1] in v:
			arr = v[x[1]]
			if len(arr) == 1:
				item = arr.pop()
				second.append((item, word))
			else:
				arr.append(word)
		else:
			v[x[1]] = [word]
	else:
		d[x[0]] = {x[1]: [word]}
first = []
for n in d:
	v = d[n]
	prev = None
	for e in v:
		arr = v[e]
		if len(arr) == 1:
			if prev == None:
				prev = arr[0]
			else:
				first.append((prev, arr[0]))
				prev = None
if len(first) >= len(second):
	print(len(second))
	for i in range(len(second)):
		print(first[i][0] + ' ' + second[i][0])
		print(first[i][1] + ' ' + second[i][1])
else:
	print(len(first) + int((len(second) - len(first)) / 2))
	for i in range(len(first)):
		print(first[i][0] + ' ' + second[i][0])
		print(first[i][1] + ' ' + second[i][1])
	i = len(first)
	while i < len(second):
		if i + 1 < len(second):
			print(second[i][0] + ' ' + second[i + 1][0])
			print(second[i][1] + ' ' + second[i + 1][1])
			i += 2
		else:
			break


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
n = iinp()
ml = [inp() for i in range(n)]
md = dd(int)
md1 = dd(list)
p = []
flg = [True] * n
for i in range(n):
	c = 0
	f = ''
	for l in ml[i]:
		if l in 'aeiou':
			c += 1
			f = l
	x = str(c) + f
	if md[x] != 0:
		p.append((i, md[x]))
		flg[i] = False
		flg[md[x]] = False
		md[x] = 0
	else:
		md[x] = i
	md1[c].append(i)
p2 = []
for (k, v) in md1.items():
	v = [i for i in v if flg[i]]
	while len(v) > 1:
		x1 = v.pop()
		x2 = v.pop()
		p2.append((x1, x2))
a1 = len(p)
a2 = len(p2)
while a1 > a2:
	p2.append(p.pop())
	a1 -= 1
	a2 += 1
print(a1)
for i in range(a1):
	print(ml[p2[i][0]], ml[p[i][0]])
	print(ml[p2[i][1]], ml[p[i][1]])


n = int(input())
la = []
le = []
li = []
lo = []
lu = []
ans = []
d1 = {}
for i in range(n):
	s = input()
	x = s.count('a') + s.count('e') + s.count('i') + s.count('o') + s.count('u')
	if x > 0:
		for c in s[::-1]:
			if c == 'a' or c == 'e' or c == 'i' or (c == 'o') or (c == 'u'):
				break
		if (x, c) in d1:
			d1[x, c].append(s)
		else:
			d1[x, c] = [s]
d2 = {}
pairs1 = []
pairs2 = []
for k in d1:
	if len(d1[k]) % 2 == 1:
		if k[0] in d2:
			d2[k[0]].append(d1[k][0])
		else:
			d2[k[0]] = [d1[k][0]]
		for i in range(1, len(d1[k]), 2):
			pairs1.append((d1[k][i], d1[k][i + 1]))
	else:
		for i in range(0, len(d1[k]), 2):
			pairs1.append((d1[k][i], d1[k][i + 1]))
for k in d2:
	if len(d2[k]) > 1:
		if len(d2[k]) % 2 == 1:
			d2[k].pop()
		for i in range(0, len(d2[k]), 2):
			pairs2.append((d2[k][i], d2[k][i + 1]))
if len(pairs1) < len(pairs2):
	print(len(pairs1))
	for i in range(len(pairs1)):
		print(pairs2[i][0], pairs1[i][0])
		print(pairs2[i][1], pairs1[i][1])
else:
	print(len(pairs2) + (len(pairs1) - len(pairs2)) // 2)
	for i in range(len(pairs2)):
		print(pairs2[i][0], pairs1[i][0])
		print(pairs2[i][1], pairs1[i][1])
	for j in range(len(pairs2), len(pairs1), 2):
		if j == len(pairs1) - 1:
			break
		else:
			print(pairs1[j][0], pairs1[j + 1][0])
			print(pairs1[j][1], pairs1[j + 1][1])


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10 ** 5)
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
n = int(input())
la = []
for i in range(n):
	la.append(input())
hash = defaultdict(set)
new_hash = defaultdict(list)
l = []
cnti = defaultdict(int)
for i in la:
	last = -1
	cnt = 0
	cnti[i] += 1
	for j in i:
		if j == 'a' or j == 'e' or j == 'i' or (j == 'o') or (j == 'u'):
			cnt += 1
			last = j
	if last != -1:
		hash[cnt].add(i)
		if new_hash[last, cnt] == []:
			new_hash[last, cnt].append(i)
		else:
			z = new_hash[last, cnt].pop()
			l.append((z, i))
for (a, b) in l:
	cnti[a] -= 1
	cnti[b] -= 1
ans = []
for i in la:
	cnt = 0
	if l == []:
		break
	for j in i:
		if j == 'a' or j == 'e' or j == 'i' or (j == 'o') or (j == 'u'):
			cnt += 1
			last = j
	if cnti[i] >= 2:
		cnti[i] -= 2
		(a, b) = l.pop(0)
		ans.append((i, a, i, b))
		continue
	for j in hash[cnt]:
		if cnti[i] == 0:
			break
		if cnti[j] == 0 or i == j:
			continue
		cnti[i] -= 1
		cnti[j] -= 1
		(a, b) = l.pop(0)
		ans.append((i, a, j, b))
		break
for i in range(0, len(l), 2):
	(a, b) = l[i]
	try:
		(c, d) = l[i + 1]
		ans.append((a, c, b, d))
	except:
		break
print(len(ans))
for i in ans:
	(a, b, c, d) = i
	print(a, b)
	print(c, d)


n = int(input())
vowels = {'a', 'e', 'o', 'i', 'u'}
words = []
for i in range(n):
	words.append(input())
all_pairs = {}
sec_pairs = {}
for item in words:
	(cnt, last) = (0, -1)
	for i in item:
		if i in vowels:
			cnt += 1
			last = i
	if cnt not in all_pairs:
		all_pairs[cnt] = {item: 1}
	elif item in all_pairs[cnt]:
		all_pairs[cnt][item] += 1
	else:
		all_pairs[cnt][item] = 1
	if cnt not in sec_pairs:
		sec_pairs[cnt] = {last: {item: 1}}
	elif last not in sec_pairs[cnt]:
		sec_pairs[cnt][last] = {item: 1}
	elif item not in sec_pairs[cnt][last]:
		sec_pairs[cnt][last][item] = 1
	else:
		sec_pairs[cnt][last][item] += 1
s_p = 0
s_list = []
for cnt in list(sec_pairs.keys()):
	for last in list(sec_pairs[cnt].keys()):
		s = 0
		cnt_l_list = []
		for word in list(sec_pairs[cnt][last].keys()):
			s += sec_pairs[cnt][last][word]
			cnt_l_list += sec_pairs[cnt][last][word] * [word]
		s_p += s // 2
		s_list.extend(cnt_l_list[:2 * (s // 2)])
all_p = 0
for cnt in list(all_pairs.keys()):
	s = 0
	for word in list(all_pairs[cnt].keys()):
		s += all_pairs[cnt][word]
	all_p += s // 2
ans = min(s_p, all_p // 2)
s_list = s_list[:2 * ans]
for item in s_list:
	cnt = 0
	for i in item:
		if i in vowels:
			cnt += 1
	all_pairs[cnt][item] -= 1
f_list = []
for cnt in list(all_pairs.keys()):
	cnt_l = []
	s = 0
	for word in list(all_pairs[cnt].keys()):
		cnt_l += all_pairs[cnt][word] * [word]
		s += all_pairs[cnt][word]
	f_list.extend(cnt_l[:2 * (s // 2)])
f_list = f_list[:2 * ans]
print(ans)
for i in range(ans):
	print(f_list[2 * i], s_list[2 * i])
	print(f_list[2 * i + 1], s_list[2 * i + 1])


first_pairs = []
second_pairs = []
lines = int(input())
words = {}
for i in range(lines):
	w = input()
	vow_cnt = 0
	vow_last = ''
	for c in w:
		if c in ['a', 'e', 'i', 'o', 'u']:
			vow_cnt += 1
			vow_last = c
	if vow_cnt not in words:
		words[vow_cnt] = {}
	if vow_last not in words[vow_cnt]:
		words[vow_cnt][vow_last] = w
	else:
		second_pairs.append((words[vow_cnt][vow_last], w))
		del words[vow_cnt][vow_last]
for l in words:
	first = None
	second = None
	for k in list(words[l].keys()):
		if first is None:
			first = k
			continue
		second = k
		first_pairs.append((words[l][first], words[l][second]))
		first = None
while len(first_pairs) < len(second_pairs):
	first_pairs.append(second_pairs.pop())
print(len(second_pairs))
for (f, s) in zip(first_pairs, second_pairs):
	print('{} {}'.format(f[0], s[0]))
	print('{} {}'.format(f[1], s[1]))


n = int(input())
word = []
endwith = [{} for i in range(5)]
second = []
first = {}
for i in range(n):
	w = input()
	word.append(w)
	c = 0
	lastkind = 0
	for ch in w:
		if ch == 'a':
			lastkind = 0
			c += 1
		elif ch == 'e':
			lastkind = 1
			c += 1
		elif ch == 'i':
			lastkind = 2
			c += 1
		elif ch == 'o':
			lastkind = 3
			c += 1
		elif ch == 'u':
			lastkind = 4
			c += 1
	if c not in endwith[lastkind]:
		endwith[lastkind][c] = [i]
	else:
		endwith[lastkind][c].append(i)
for i in range(5):
	for (key, value) in list(endwith[i].items()):
		while len(value) >= 2:
			second.append(value.pop())
			second.append(value.pop())
		if len(value) == 1:
			if key in first:
				first[key].append(value[0])
			else:
				first[key] = [value[0]]
ans = []
m = 0
for (key, value) in list(first.items()):
	while len(value) >= 2 and len(second) >= 2:
		ans.append((value.pop(), value.pop(), second.pop(), second.pop()))
		m += 1
while len(second) >= 4:
	ans.append((second.pop(), second.pop(), second.pop(), second.pop()))
	m += 1
print(m)
for tup in ans:
	print(word[tup[0]], word[tup[2]])
	print(word[tup[1]], word[tup[3]])


import sys
n = int(input())
setA = {'a', 'e', 'i', 'o', 'u'}
a = []
mem = []
dic = {}
dic2 = {}
count = {}
for i in range(n):
	a.append(sys.stdin.readline())
for word in a:
	word = word[:-1]
	c = 0
	last = ''
	for v in word:
		if v in setA:
			c += 1
			last = v
	m = str(c)
	mv = last + m
	if m not in dic:
		dic[m] = [1, [word]]
	else:
		dic[m][0] += 1
		dic[m][1].append(word)
	if mv not in dic2:
		dic2[mv] = [1, [word]]
	else:
		dic2[mv][0] += 1
		dic2[mv][1].append(word)
	if word not in count:
		count[word] = 1
	else:
		count[word] += 1
same = 0
spare = 0
mem = set()
col2 = []
col1 = []
for (k, v) in dic2.items():
	minus = v[0] % 2
	same += v[0] - minus
	for v1 in v[1][:v[0] - minus]:
		col2.append(v1)
		count[v1] -= 1
for (k, v) in dic.items():
	minus = v[0] % 2
	spare += v[0] - minus
	temp = []
	for v1 in v[1][:v[0] - minus]:
		if count.get(v1):
			col1.append(v1)
			count[v1] -= 1
	if len(col1) % 2 == 1:
		col1.pop(-1)
leftElement = n - same
lastChar = same
first = len(col1)
ans = 0
if lastChar > first:
	left = (lastChar - first) // 2
	if left % 2 == 1:
		left -= 1
	col1 = col1 + col2[:left]
	col2 = col2[left:]
	ans = first + left
else:
	ans = lastChar
if len(col2) % 2 == 1:
	col2.pop(0)
if len(col1) % 2 == 1:
	col1.pop(-1)
print(ans // 2)
for i in range(ans // 2 * 2):
	print(col1[i], col2[i])


import os
import sys
from io import BytesIO, IOBase
from collections import deque
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
dic = {}
n = int(input())
for _ in range(n):
	s = input()
	vowels = 0
	for i in s:
		if i == 'a' or i == 'e' or i == 'i' or (i == 'o') or (i == 'u'):
			lastvowel = i
			vowels += 1
	if lastvowel == 'a':
		p = 5 * vowels
	if lastvowel == 'e':
		p = 5 * vowels + 1
	if lastvowel == 'i':
		p = 5 * vowels + 2
	if lastvowel == 'o':
		p = 5 * vowels + 3
	if lastvowel == 'u':
		p = 5 * vowels + 4
	if p in dic:
		dic[p].append(s)
	else:
		dic[p] = [s]
strongpairs = []
pairs = []
visited = set()
for i in dic:
	if i // 5 in visited:
		continue
	for j in range(5):
		if 5 * (i // 5) + j in dic:
			while len(dic[5 * (i // 5) + j]) >= 2:
				s1 = dic[5 * (i // 5) + j].pop()
				s2 = dic[5 * (i // 5) + j].pop()
				strongpairs.append([s1, s2])
	k = []
	for j in range(5):
		if 5 * (i // 5) + j in dic:
			while dic[5 * (i // 5) + j]:
				s1 = dic[5 * (i // 5) + j].pop()
				k.append(s1)
	for j in range(0, len(k) - 1, 2):
		s1 = k[j]
		s2 = k[j + 1]
		pairs.append([s1, s2])
	visited.add(i // 5)
ans = []
if len(strongpairs) <= len(pairs):
	for i in range(len(strongpairs)):
		ans.append([pairs[i][0], strongpairs[i][0], pairs[i][1], strongpairs[i][1]])
else:
	for i in range(len(pairs)):
		ans.append([pairs[i][0], strongpairs[i][0], pairs[i][1], strongpairs[i][1]])
	i = len(pairs)
	while i + 1 < len(strongpairs):
		ans.append([strongpairs[i][0], strongpairs[i + 1][0], strongpairs[i][1], strongpairs[i + 1][1]])
		i += 2
print(len(ans))
for k in ans:
	print(' '.join(k))


from collections import defaultdict as dd
import math
import sys

def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return map(int, input().split())

def lm():
	return list(map(int, input().split()))
vset = set(['a', 'e', 'i', 'o', 'u'])
n = nn()

def process(word):
	lastval = 0
	vs = 0
	for i in range(len(word)):
		if word[i] in vset:
			vs += 1
			lastval = word[i]
	return (vs, lastval)
words = []
for i in range(n):
	words.append(input())
lastpairs = []
pairsdict = {}
for word in words:
	(i, j) = process(word)
	if (i, j) in pairsdict:
		lastpairs.append((word, pairsdict[i, j]))
		del pairsdict[i, j]
	else:
		pairsdict[i, j] = word
left = []
for tup in pairsdict:
	left.append(pairsdict[tup])
firstdict = {}
firstpairs = []
for word in left:
	i = process(word)[0]
	if i in firstdict:
		firstpairs.append((word, firstdict[i]))
		del firstdict[i]
	else:
		firstdict[i] = word
if len(firstpairs) >= len(lastpairs):
	print(len(lastpairs))
	for j in range(len(lastpairs)):
		print(firstpairs[j][0] + ' ' + lastpairs[j][0])
		print(firstpairs[j][1] + ' ' + lastpairs[j][1])
else:
	if (len(lastpairs) - len(firstpairs)) % 2 == 1:
		lastpairs.pop()
	l = len(firstpairs)
	print((len(firstpairs) + len(lastpairs)) // 2)
	for j in range(len(firstpairs)):
		print(firstpairs[j][0] + ' ' + lastpairs[j][0])
		print(firstpairs[j][1] + ' ' + lastpairs[j][1])
	for k in range(0, (len(lastpairs) - len(firstpairs)) // 2):
		print(lastpairs[l + 2 * k][0] + ' ' + lastpairs[l + 2 * k + 1][0])
		print(lastpairs[l + 2 * k][1] + ' ' + lastpairs[l + 2 * k + 1][1])


from collections import defaultdict, namedtuple
VOWELS = {'a', 'e', 'o', 'i', 'u'}
Word = namedtuple('Word', ['value', 'index'])
WordPair = namedtuple('WordPair', ['word1', 'word2'])

class LenWordCollection:

	def __init__(self):
		self.by_letter = defaultdict(set)

def process_word(word):
	total = 0
	last = None
	for letter in word:
		if letter in VOWELS:
			last = letter
			total += 1
	return (total, last)
n = int(input())
WORDS = defaultdict(LenWordCollection)
for i in range(n):
	word = input()
	(vowels, last_vowel) = process_word(word)
	WORDS[vowels].by_letter[last_vowel].add(Word(value=word, index=i))
full_pairs = set()
semi_pairs = set()
for len_word in WORDS.values():
	remnants = set()
	for letter_set in len_word.by_letter.values():
		while len(letter_set) >= 2:
			word1 = letter_set.pop()
			word2 = letter_set.pop()
			full_pairs.add(WordPair(word1, word2))
		if letter_set:
			remnants |= letter_set
	while len(remnants) >= 2:
		word1 = remnants.pop()
		word2 = remnants.pop()
		semi_pairs.add(WordPair(word1, word2))
lyrics = []
while full_pairs and semi_pairs:
	pair1 = semi_pairs.pop()
	pair2 = full_pairs.pop()
	lyrics.append((pair1, pair2))
while len(full_pairs) >= 2:
	pair1 = full_pairs.pop()
	pair2 = full_pairs.pop()
	lyrics.append((pair1, pair2))
print(len(lyrics))
for lyric in lyrics:
	print(lyric[0].word1.value, lyric[1].word1.value)
	print(lyric[0].word2.value, lyric[1].word2.value)


n = int(input())
a = [None] * n
d = dict()
vov = list('aeiou')
for i in range(n):
	a[i] = input()
	vc = 0
	lv = 'a'
	for j in a[i]:
		if j in vov:
			vc += 1
			lv = j
	try:
		d[vc][lv].append(a[i])
	except:
		d[vc] = {'a': [], 'e': [], 'i': [], 'o': [], 'u': []}
		d[vc][lv].append(a[i])
ans = [[-1 for i in range(4)] for j in range(n)]
si = 0
fi = 0
for i in d.values():
	if fi != int(fi):
		fi -= 0.5
	for j in i.values():
		for k in range(len(j) // 2):
			ans[si][1] = j[2 * k]
			ans[si][3] = j[2 * k + 1]
			si += 1
		for k in range(len(j) // 2 * 2, len(j)):
			if int(fi) == fi:
				ans[int(fi)][0] = j[k]
			else:
				ans[int(fi)][2] = j[k]
			fi += 0.5
fa = []
icans = []
for i in range(len(ans)):
	if ans[i].count(-1) == 0:
		fa.append(ans[i][:])
	elif ans[i][1] != -1 and ans[i][3] != -1:
		icans.append([ans[i][1], ans[i][3]])
print(len(fa) + len(icans) // 2)
for i in range(len(fa)):
	print(fa[i][0], fa[i][1])
	print(fa[i][2], fa[i][3])
for i in range(len(icans) // 2):
	print(icans[i * 2][0], icans[i * 2 + 1][0])
	print(icans[i * 2][1], icans[i * 2 + 1][1])


import sys
import collections
input = sys.stdin.readline
N = int(input().strip())
words = [input().strip() for _ in range(N)]
last_vowel = collections.defaultdict(list)
vowel_counts = collections.defaultdict(list)
visited = set()
for (i, word) in enumerate(words):
	cnt = 0
	last_char = None
	for (ii, letter) in enumerate(word):
		if letter in 'aeiou':
			cnt += 1
			last_char = letter
	last_vowel[last_char, cnt] += [(word, last_char, cnt)]
char_end_pairs = []
for words in last_vowel.values():
	while len(words) >= 2:
		char_end_pairs += [(words.pop(), words.pop())]
	if words:
		word = words.pop()
		vowel_counts[word[2]] += [word]
char_pairs = []
for words in vowel_counts.values():
	while len(words) >= 2:
		char_pairs += [(words.pop(), words.pop())]
ans = []
while char_end_pairs:
	word = [w[0] for w in char_end_pairs.pop()]
	if char_pairs:
		n_word = [w[0] for w in char_pairs.pop()]
	elif char_end_pairs:
		n_word = [w[0] for w in char_end_pairs.pop()]
	else:
		break
	ans += [(n_word[0], word[0], n_word[1], word[1])]
print(len(ans))
for res in ans:
	print(res[0], res[1])
	print(res[2], res[3])


from sys import stdin, setrecursionlimit
from collections import defaultdict

def get_vowel_count(word):
	count = 0
	for i in word:
		if i in ['a', 'e', 'i', 'o', 'u']:
			count += 1
	return count

def get_last_vowel(word):
	for i in range(len(word) - 1, -1, -1):
		if word[i] in ['a', 'e', 'i', 'o', 'u']:
			return word[i]

def make(i, v):
	return str(i) + ' ' + str(v)
n = int(stdin.readline().strip())
mydict = defaultdict(list)
for _ in range(n):
	word = stdin.readline().strip()
	vowel_count = get_vowel_count(word)
	if vowel_count in mydict:
		mydict[vowel_count].append(word)
	else:
		mydict[vowel_count] = [word]
last_vowel = defaultdict(list)
for i in mydict:
	for word in mydict[i]:
		lv = get_last_vowel(word)
		if make(i, lv) in last_vowel:
			last_vowel[make(i, lv)].append(word)
		else:
			last_vowel[make(i, lv)] = [word]
line_1 = []
line_2 = []
count = 0
f_1 = None
s_1 = None
f_2 = None
s_2 = None
for i in last_vowel:
	while len(last_vowel[i]) >= 2:
		f_2 = last_vowel[i].pop()
		s_2 = last_vowel[i].pop()
		temp = [f_2, s_2]
		line_2.append(temp)
	else:
		if len(last_vowel[i]) > 0:
			new = int(list(i.split())[0])
			if count == 0:
				prev = new
				count = 1
				f_1 = last_vowel[i].pop()
			elif count == 1 and new == prev:
				s_1 = last_vowel[i].pop()
				count = 0
				temp = [f_1, s_1]
				line_1.append(temp)
			else:
				count = 1
				prev = new
				f_1 = last_vowel[i].pop()
if len(line_2) > len(line_1):
	print(len(line_1) + abs(len(line_2) - len(line_1)) // 2)
	for i in range(len(line_1)):
		print(line_1[i][0], line_2[i][0])
		print(line_1[i][1], line_2[i][1])
	for i in range(len(line_1), len(line_2), 2):
		if i + 1 < len(line_2):
			print(line_2[i][0], line_2[i + 1][0])
			print(line_2[i][1], line_2[i + 1][1])
else:
	print(len(line_2))
	for i in range(len(line_2)):
		print(line_1[i][0], line_2[i][0])
		print(line_1[i][1], line_2[i][1])


import sys
input = sys.stdin.readline

def last_vowel(s):
	r = ''
	for c in s:
		if c in 'aeiou':
			r = c
	return r

def count_vowel(s):
	r = 0
	for c in s:
		r += 1 if c in 'aeiou' else 0
	return r
n = int(input())
words = {'a': {}, 'e': {}, 'i': {}, 'o': {}, 'u': {}}
for i in range(n):
	s = input().rstrip()
	lv = last_vowel(s)
	cnt = count_vowel(s)
	if not cnt in words[lv]:
		words[lv][cnt] = []
	words[lv][cnt].append(s)
cpairs = []
twords = []
tpairs = []
for lv in 'aeiou':
	for cnt in words[lv]:
		for i in range(len(words[lv][cnt]) // 2):
			cpairs.append((words[lv][cnt][2 * i], words[lv][cnt][2 * i + 1]))
		if len(words[lv][cnt]) % 2 == 1:
			twords.append((cnt, words[lv][cnt][-1]))
twords.sort()
t = None
for w in twords:
	if t == None:
		t = w
	elif t[0] == w[0]:
		tpairs.append((t[1], w[1]))
		t = None
	else:
		t = w
res = []
while len(tpairs) > 0 and len(cpairs) > 0:
	res.append((tpairs.pop(), cpairs.pop()))
while len(cpairs) > 1:
	res.append((cpairs.pop(), cpairs.pop()))
print(len(res))
for p in res:
	print('{} {}\n{} {}'.format(p[0][0], p[1][0], p[0][1], p[1][1]))


from collections import defaultdict
vow = 'aeoiu'

def vowels(word):
	c = 0
	for i in word:
		if i in vow:
			c += 1
	return c

def last_vov(word):
	for i in reversed(word):
		if i in vow:
			return i
dic = defaultdict(lambda : defaultdict(list))
for _ in range(int(input())):
	inp = input()
	dic[vowels(inp)][last_vov(inp)].append(inp)
(first_w, second_w) = ([], [])
for i in dic.values():
	first_w_t = []
	for words in i.values():
		if len(words) % 2 == 1:
			if len(words) >= 2:
				second_w += words[:-1]
			first_w_t.append(words[-1])
		else:
			second_w += words
	if len(first_w_t) >= 2:
		if len(first_w_t) % 2 == 1:
			first_w += first_w_t[:-1]
		else:
			first_w += first_w_t
while len(second_w) > len(first_w):
	first_w.append(second_w.pop())
	first_w.append(second_w.pop())
print(len(second_w) // 2)
for i in range(min(len(second_w), len(first_w))):
	print(first_w[i], second_w[i])


import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
N = int(input())
words = [input()[:-1] for _ in range(N)]
vowels = ('a', 'i', 'u', 'e', 'o')
counted_word = []
for word in words:
	last_vowel = ''
	num_vowel = 0
	for c in word:
		if c in vowels:
			num_vowel += 1
			last_vowel = c
	counted_word.append([word, num_vowel, last_vowel])
counted_word = sorted(counted_word, key=lambda x: (x[1], x[2]))
cand_second = []
unused = []
used = [False] * N
for (i, w1, w2) in zip(list(range(N)), counted_word, counted_word[1:]):
	if used[i]:
		continue
	if w1[1] == w2[1] and w1[2] == w2[2]:
		cand_second.append([w1, w2])
		used[i] = True
		used[i + 1] = True
	else:
		unused.append(w1)
if not used[-1]:
	unused.append(counted_word[-1])
cand_first = []
used = [0] * len(unused)
for (i, w1, w2) in zip(list(range(len(unused))), unused, unused[1:]):
	if used[i]:
		continue
	if w1[1] == w2[1]:
		cand_first.append([w1, w2])
		used[i] = True
		used[i + 1] = True
len_first = len(cand_first)
len_second = len(cand_second)
diff = len_second - len_first
if diff > 1:
	for i in range(diff // 2):
		cand_first.append(cand_second[-i - 1])
ans = min(len_second, len(cand_first))
print(ans)
for (first, second) in zip(cand_first, cand_second):
	print(first[0][0], second[0][0])
	print(first[1][0], second[1][0])


n = int(input())
G = ['a', 'e', 'i', 'o', 'u']
a = []
dic1 = dict()
for i in range(n):
	s = input()
	a.append(s)
	last = 'a'
	counter = 0
	for i in s:
		if i in G:
			last = i
			counter += 1
	dic1[last, counter] = dic1.get((last, counter), [])
	dic1[last, counter].append(s)
end_words = []
start_word = []
dic2 = dict()
for i in dic1.keys():
	while len(dic1[i]) > 1:
		fir = dic1[i].pop()
		sec = dic1[i].pop()
		end_words.append([fir, sec])
	if len(dic1[i]) > 0:
		dic2[i[1]] = dic2.get(i[1], [])
		dic2[i[1]].append(dic1[i].pop())
for i in dic2.keys():
	while len(dic2[i]) > 1:
		fir = dic2[i].pop()
		sec = dic2[i].pop()
		start_word.append([fir, sec])
ans = 0
ans = min(len(start_word), len(end_words))
if len(end_words) - len(start_word) > 1:
	ans += (len(end_words) - len(start_word)) // 2
print(ans)
for i in range(min(len(start_word), len(end_words))):
	end1 = end_words.pop()
	start1 = start_word.pop()
	print(start1[0], end1[0])
	print(start1[1], end1[1])
if len(end_words) >= 2:
	for i in range(len(end_words) // 2):
		end1 = end_words.pop()
		start1 = end_words.pop()
		print(start1[0], end1[0])
		print(start1[1], end1[1])


import sys

class CBeautifulLyrics:

	def solve(self):
		n = int(input())
		c = {}
		for _ in range(n):
			word = input().strip()
			cnt = 0
			last = -1
			for x in word:
				if x in 'aoeui':
					cnt += 1
					last = x
			if cnt in c:
				c[cnt][last].append(word)
			else:
				c[cnt] = {key: [] for key in list('aeoiu') + [-1]}
				c[cnt][last].append(word)
		good = []
		for last in 'aeoui':
			for cnt in c:
				good.extend([(c[cnt][last][i], c[cnt][last][i + 1]) for i in range(0, len(c[cnt][last]) - 1, 2)])
		semi_good = []
		for cnt in c:
			cur = []
			for last in list('aeoui') + [-1]:
				if len(c[cnt][last]) % 2 == 1:
					cur.append(c[cnt][last][-1])
			semi_good.extend([(cur[i], cur[i + 1]) for i in range(0, len(cur) - 1, 2)])
		print(min(len(semi_good), len(good)) + (len(good) - min(len(semi_good), len(good))) // 2)
		gd_i = 0
		nb_good = len(good)
		nb_smgood = len(semi_good)
		for (smi_i, sm_pair) in enumerate(semi_good):
			if gd_i >= nb_good:
				break
			gd_pair = good[gd_i]
			((a, c), (b, d)) = (sm_pair, gd_pair)
			print(a, b)
			print(c, d)
			gd_i += 1
		while gd_i + 1 < nb_good:
			((a, c), (b, d)) = (good[gd_i], good[gd_i + 1])
			print(a, b)
			print(c, d)
			gd_i += 2
solver = CBeautifulLyrics()
input = sys.stdin.readline
solver.solve()


from collections import defaultdict
import sys
input = lambda : sys.stdin.readline().strip()

def f(x):
	cnt = 0
	for i in x:
		if i in 'aeiou':
			cnt += 1
	return cnt

def last_vowel(s):
	for i in s[::-1]:
		if i in 'aeiou':
			return i
n = int(input())
sarr = [input() for i in range(n)]
d = defaultdict(list)
for s in sarr:
	d[f(s), last_vowel(s)].append(s)
same_same = []
same_different = defaultdict(list)
for (i, j) in d.items():
	if len(j) >= 2:
		if len(j) % 2 == 1:
			same_different[i[0]].append(j[-1])
			j.pop()
		for i in range(0, len(j), 2):
			same_same.append((j[i], j[i + 1]))
	else:
		same_different[i[0]].append(j[0])
same_different_list = []
for (i, j) in same_different.items():
	if len(j) >= 2:
		if len(j) % 2 == 1:
			j.pop()
		for i in range(0, len(j), 2):
			same_different_list.append((j[i], j[i + 1]))
ans = []
while same_same and same_different_list:
	ans.append((same_same[-1], same_different_list[-1]))
	same_same.pop()
	same_different_list.pop()
while len(same_same) >= 2:
	ans.append((same_same[-1], same_same[-2]))
	same_same.pop()
	same_same.pop()
print(len(ans))
for ((b1, b2), (a1, a2)) in ans:
	sys.stdout.write(a1 + ' ' + b1 + '\n')
	sys.stdout.write(a2 + ' ' + b2 + '\n')


import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree1:

	def __init__(self, data, default=9999999, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] > k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater

def count(e):
	l = '1'
	c = 0
	for i in range(len(e)):
		if e[i] in 'aeiou':
			c += 1
			l = e[i]
	return (c, l)
a = []
for i in range(int(input())):
	a.append(input())
d = dict()
d1 = dict()
for i in range(len(a)):
	(c, e) = count(a[i])
	if (c, e) in d:
		d[c, e].append(a[i])
	else:
		d.update({(c, e): deque([a[i]])})
	if c in d1:
		d1[c].append(a[i])
	else:
		d1.update({c: deque([a[i]])})
ma = 0
m1 = 0
for (i, j) in d:
	ma = ma + len(d[i, j]) // 2
for i in d1:
	m1 = m1 + len(d1[i]) // 2
m1 = m1 // 2
ans = min(ma, m1)
print(ans)
q = []
second = []
c = 0
first = []
f = 0
for (i, j) in d:
	for k in range(len(d[i, j]) - len(d[i, j]) % 2):
		second.append(d[i, j][0])
		d[i, j].popleft()
		if k % 2 == 1:
			c += 1
		if c == ans:
			f = 1
			break
	if f == 1:
		break
d1 = dict()
for (i, j) in d:
	for k in range(len(d[i, j])):
		if i not in d1:
			d1.update({i: [d[i, j][k]]})
		else:
			d1[i].append(d[i, j][k])
for i in d1:
	for k in range(len(d1[i]) - len(d1[i]) % 2):
		first.append(d1[i][k])
for i in range(2 * ans):
	print(first[i], second[i])


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	n = int(input())
	dict1 = {}
	vowels = set(['a', 'e', 'i', 'o', 'u'])
	words = []
	for s in range(n):
		v0 = input()
		words.append(v0)
		word = [k for k in v0]
		vow = 0
		last = -1
		for i in range(len(word)):
			if word[i] in vowels:
				vow += 1
				last = word[i]
		if not vow in dict1:
			dict1[vow] = [[] for s in range(26)]
		dict1[vow][ord(last) - 97].append(s)
	a = set([])
	b = set([])
	for s in dict1.keys():
		p1 = []
		for i in range(26):
			while len(dict1[s][i]) >= 2:
				v1 = dict1[s][i].pop()
				v2 = dict1[s][i].pop()
				b.add((v1, v2))
			while len(dict1[s][i]) >= 1:
				p1.append(dict1[s][i].pop())
		while len(p1) >= 2:
			a.add((p1.pop(), p1.pop()))
	lyrics = []
	while len(a) > 0 and len(b) > 0:
		lyrics.append((a.pop(), b.pop()))
	while len(b) >= 2:
		lyrics.append((b.pop(), b.pop()))
	print(len(lyrics))
	for s in range(len(lyrics)):
		lyric = lyrics[s]
		line1 = (lyric[0][0], lyric[1][0])
		line2 = (lyric[0][1], lyric[1][1])
		print(words[line1[0]], words[line1[1]])
		print(words[line2[0]], words[line2[1]])
main()


import sys, heapq
from collections import deque, defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl = lambda : list(map(int, input().split()))
inm = lambda : list(map(int, input().split()))
DBG = True

def ddprint(x):
	if DBG:
		print(x)
n = inn()
vowels = ['a', 'e', 'i', 'o', 'u']
h = {}
for v in vowels:
	h[v] = {}
counts = defaultdict(int)
for i in range(n):
	s = input()
	cnt = 0
	lastvow = '.'
	for j in range(len(s)):
		if s[j] in vowels:
			cnt += 1
			lastvow = s[j]
	if cnt not in h[lastvow]:
		h[lastvow][cnt] = []
	h[lastvow][cnt].append(s)
	counts[cnt] += 1
npairs = 0
for cnt in counts:
	npairs += counts[cnt] // 2
nvpairs = 0
for v in vowels:
	for cnt in h[v]:
		nvpairs += len(h[v][cnt]) // 2
nlyrics = min(npairs // 2, nvpairs)
if nlyrics == 0:
	print(0)
	return
lyrics = [0] * nlyrics
lcnt = 0
for v in vowels:
	for cnt in h[v]:
		while len(h[v][cnt]) >= 2:
			w21 = h[v][cnt].pop()
			w22 = h[v][cnt].pop()
			lyrics[lcnt] = [w21, w22]
			lcnt += 1
			if lcnt == nlyrics:
				break
		if lcnt == nlyrics:
			break
	if lcnt == nlyrics:
		break
words = {}
for v in vowels:
	for cnt in h[v]:
		if cnt not in words:
			words[cnt] = []
		words[cnt].extend(h[v][cnt])
lcnt = 0
for cnt in words:
	while len(words[cnt]) >= 2:
		w11 = words[cnt].pop()
		w12 = words[cnt].pop()
		lyrics[lcnt].extend([w11, w12])
		lcnt += 1
		if lcnt == nlyrics:
			break
	if lcnt == nlyrics:
		break
print(nlyrics)
for z in lyrics:
	print('{} {}'.format(z[2], z[0]))
	print('{} {}'.format(z[3], z[1]))


from collections import defaultdict
hml = defaultdict(lambda : defaultdict(list))
last = []
first = []
n = int(input())
for _ in range(0, n):
	s = input()
	(vwc, vw) = (0, '')
	for j in s:
		if j in 'aeiou':
			vwc += 1
			vw = j
	hml[vwc][vw] += [s]
for i in hml:
	left = []
	for j in hml[i]:
		pos = len(hml[i][j]) // 2
		ll = len(hml[i][j]) % 2
		while pos:
			last += [(hml[i][j][0], hml[i][j][1])]
			pos -= 1
			hml[i][j].pop(0)
			hml[i][j].pop(0)
		if ll:
			left += [hml[i][j][0]]
	if len(left) > 0:
		npos = len(left) // 2
		while npos:
			first += [(left[0], left[1])]
			npos -= 1
			left.pop(0)
			left.pop(0)
ff = min(len(first), len(last))
co = (len(last) - ff) // 2
ans = ff
if co > 0:
	ans += co
print(ans)
for i in range(0, ff):
	print(first[i][0], last[i][0])
	print(first[i][1], last[i][1])
i = ff
while co > 0:
	print(last[i][0], last[i + 1][0])
	print(last[i][1], last[i + 1][1])
	i += 2
	co -= 1


from collections import Counter
import sys

def count(word):
	lst = ''
	k = 0
	for el in word:
		if el in gl:
			k += 1
			lst = el
	return (k, lst)
n = int(input())
gl = set('aeoui')
d = dict()
b = dict()
for i in range(n):
	t = input()
	s = count(t)
	if s[0] in b:
		b[s[0]][t] += 1
	else:
		b[s[0]] = Counter()
		b[s[0]][t] += 1
	if s in d:
		d[s].append(t)
	else:
		d[s] = [t]
leftpair = []
rightpair = []
for el in d:
	for i in range(0, len(d[el]) - 1, 2):
		rightpair.append((d[el][i], d[el][i + 1]))
		b[el[0]][d[el][i]] -= 1
		b[el[0]][d[el][i + 1]] -= 1
for el in b:
	last1len = -1
	for ell in b[el]:
		if b[el][ell] % 2 == 1:
			if last1len != -1:
				leftpair[last1len].append(ell)
				last1len = -1
			else:
				leftpair.append([ell])
				last1len = len(leftpair) - 1
		for k in range(b[el][ell] // 2):
			leftpair.append((ell, ell))
	if last1len != -1:
		leftpair.pop(last1len)
if len(rightpair) > len(leftpair):
	t = (len(rightpair) + len(leftpair)) // 2
	leftpair.extend(rightpair[t:])
	rightpair = rightpair[:t]
print(min(len(leftpair), len(rightpair)))
for i in range(min(len(leftpair), len(rightpair))):
	sys.stdout.write(leftpair[i][0] + ' ' + rightpair[i][0] + '\n' + leftpair[i][1] + ' ' + rightpair[i][1] + '\n')


from collections import defaultdict
import sys
input = sys.stdin.readline
n = int(input())
D = []
v = ['a', 'i', 'u', 'e', 'o']
d = {'a': 0, 'i': 1, 'u': 2, 'e': 3, 'o': 4}
G = defaultdict(list)
for i in range(n):
	s = input()
	k = 0
	t = -1
	for j in range(len(s)):
		if s[j] in v:
			k += 1
			t = d[s[j]]
	G[k].append((s, t))
(L, R) = ([], [])
for v in G.values():
	P = [[] for i in range(5)]
	tmp = []
	for (s, t) in v:
		P[t].append(s)
	for j in range(5):
		k = 0
		while k + 1 < len(P[j]):
			R.append(P[j][k])
			R.append(P[j][k + 1])
			k += 2
		if k < len(P[j]):
			tmp.append(P[j][k])
	if len(tmp) % 2 == 0:
		L.extend(tmp)
	else:
		L.extend(tmp[1:])
if len(L) < len(R):
	print((len(L) + (len(R) - len(L)) // 2) // 2)
	i = 0
	while i < len(L):
		print(L[i], R[i])
		i += 1
	while i + 3 < len(R):
		print(R[i], R[i + 2])
		print(R[i + 1], R[i + 3])
		i += 4
else:
	print(len(R) // 2)
	for i in range(len(R)):
		print(L[i], R[i])


from sys import stdin, stdout
from collections import defaultdict
input = stdin.readline
print = stdout.write
n = int(input())
d = defaultdict(list)
vo = set(['a', 'e', 'i', 'o', 'u'])
c = defaultdict(list)
fw = []
sw = []
e = [0] * n
for i in range(n):
	a = input()
	a = a[:len(a) - 1]
	k = 0
	for j in a:
		if j in vo:
			k += 1
			la = j
	if k == 0:
		d[0].append(a)
	elif len(d[str(k) + ' ' + la]) > 0:
		r = d[str(k) + ' ' + la].pop()
		sw.append([r, a])
	else:
		d[str(k) + ' ' + la].append(a)
f = defaultdict(list)
for i in d.keys():
	x = int(i.split()[0])
	for j in d[i]:
		f[x].append(j)
ans = []
fl = 0
for i in f.keys():
	for j in range(1, len(f[i]), 2):
		if len(sw) > 0:
			ans.append([f[i][j], f[i][j - 1], sw.pop()])
		else:
			fl = 1
			break
	if fl == 1:
		break
for i in range(1, len(d[0]), 2):
	if len(sw) > 0:
		ans.append([d[0][i], d[0][i - 1], sw.pop()])
for i in range(1, len(sw), 2):
	r = sw[i]
	ans.append([sw[i][0], sw[i][1], sw[i - 1]])
print(str(len(ans)) + '\n')
for i in ans:
	print(i[0] + ' ' + i[2][0] + '\n')
	print(i[1] + ' ' + i[2][1] + '\n')


voy = ['a', 'e', 'i', 'o', 'u']

def de(a):
	for i in a[::-1]:
		if i in voy:
			return i
di = {}
ta = set()
for k in range(int(input())):
	a = input()
	nb = sum((i in voy for i in a))
	if not nb in ta:
		for v in voy:
			di[nb, v] = []
		ta.add(nb)
	d = de(a)
	cl = (nb, d)
	di[cl].append(a)
co1 = sum((len(di[k]) // 2 for k in di))
co2 = sum((sum((len(di[k, v]) for v in voy)) // 2 for k in ta)) // 2
wo = []
co = min(co1, co2)
nb = 0
for k in di:
	nbl = 0
	for (i, j) in zip(di[k][::2], di[k][1::2]):
		if nb != co:
			wo.append([i, j])
			nb += 1
			nbl += 1
	di[k] = di[k][2 * nbl:]
di2 = [di[k, 'a'] + di[k, 'e'] + di[k, 'i'] + di[k, 'o'] + di[k, 'u'] for k in ta]
p = 0
for k in di2:
	for (i, j) in zip(k[::2], k[1::2]):
		if p != len(wo):
			wo[p].append(i)
			wo[p].append(j)
			p += 1
print(co)
for k in wo:
	print(k[2], k[0])
	print(k[3], k[1])


n = int(input())
words = [input() for i in range(n)]
d = {}
for w in words:
	vs = ''.join([c if c in 'aeiou' else '' for c in w])
	v = len(vs)
	last = vs[-1]
	if not v in d:
		d[v] = {}
	dd = d[v]
	if not last in dd:
		dd[last] = []
	dd[last].append(w)
pairs = []
e = {}
for (v, dd) in list(d.items()):
	for (c, l) in list(dd.items()):
		while len(l) > 1:
			p = (l.pop(), l.pop())
			pairs.append(p)
		if len(l) > 0:
			if v in e:
				e[v] += l
			else:
				e[v] = l
ans = []
for (c, l) in list(e.items()):
	while len(l) > 1 and len(pairs) > 0:
		a = (l.pop(), l.pop())
		for (i, j) in zip(a, pairs.pop()):
			ans.append((i, j))
while len(pairs) > 1:
	for (i, j) in zip(pairs.pop(), pairs.pop()):
		ans.append((i, j))
print(len(ans) // 2)
for (i, j) in ans:
	print(i, j)


def p(a):
	print()
	for i in range(len(a)):
		print(i, '-', a[i])
n = int(input())
slova = []
glas = []
for i in range(n):
	s = input()
	lastG = ''
	k = 0
	for ch in s:
		if ch == 'a' or ch == 'e' or ch == 'o' or (ch == 'i') or (ch == 'u'):
			k += 1
			lastG = ch
	if len(slova) < k:
		for j in range(len(slova), k):
			slova.append([])
			glas.append([])
	slova[k - 1].append(s)
	glas[k - 1].append(lastG)
strofy1 = []
strofy2 = []
for k1 in range(len(glas)):
	if len(glas[k1]) > 1:
		for k2 in range(len(glas[k1]) - 1):
			if glas[k1][k2] == '':
				continue
			k4 = k2
			for k3 in range(k2 + 1, len(glas[k1])):
				if glas[k1][k2] == glas[k1][k3]:
					k4 = k3
					break
			if k4 > k2:
				strofy2.append([slova[k1][k2], slova[k1][k4]])
				glas[k1][k4] = ''
				glas[k1][k2] = ''
				slova[k1][k4] = ''
				slova[k1][k2] = ''
	sss = ''
	while len(glas[k1]) > 0:
		if slova[k1][0] != '':
			if sss == '':
				sss = slova[k1][0]
			else:
				strofy1.append([sss, slova[k1][0]])
				sss = ''
		del glas[k1][0]
		del slova[k1][0]
minStrofy = min(len(strofy1), len(strofy2))
res = minStrofy + (len(strofy2) - minStrofy) // 2
print(res)
for i in range(minStrofy):
	print(strofy1[i][0], strofy2[i][0])
	print(strofy1[i][1], strofy2[i][1])
for i in range(minStrofy, len(strofy2) - 1, 2):
	print(strofy2[i][0], strofy2[i + 1][0])
	print(strofy2[i][1], strofy2[i + 1][1])


n = int(input())
dict_ = {}
vowel = 'aeiou'
for i in range(n):
	s = str(input())
	cnt = 0
	right = -1
	for j in s:
		if j in vowel:
			cnt += 1
			right = j
	right = vowel.index(right)
	try:
		dict_[cnt].append((right, s))
	except:
		KeyError
		dict_[cnt] = [(right, s)]
for i in dict_.keys():
	dict_[i].sort()
first = []
second = []
for i in dict_.keys():
	j = 0
	prev = -1
	while j < len(dict_[i]) - 1:
		if dict_[i][j][0] == dict_[i][j + 1][0]:
			second.append((dict_[i][j][1], dict_[i][j + 1][1]))
			j += 2
		elif prev != -1:
			first.append((dict_[i][prev][1], dict_[i][j][1]))
			j += 1
			prev = -1
		else:
			prev = j
			j += 1
	if prev != -1 and j == len(dict_[i]) - 1:
		first.append((dict_[i][prev][1], dict_[i][len(dict_[i]) - 1][1]))
i = 0
ans = []
while i < len(first) and i < len(second):
	ans.append(first[i][0])
	ans.append(second[i][0])
	ans.append(first[i][1])
	ans.append(second[i][1])
	i += 1
while i < len(second) - 1:
	ans.append(second[i][0])
	ans.append(second[i + 1][0])
	ans.append(second[i][1])
	ans.append(second[i + 1][1])
	i += 2
print(len(ans) // 4)
print(*ans)


import sys
from collections import defaultdict as dd
from collections import deque
from functools import *
from fractions import Fraction as f
from copy import *
from bisect import *
from heapq import *
from math import *
from itertools import permutations

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def inc(d, c):
	d[c] = d[c] + 1 if c in d else 1

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)

def bo(i):
	return ord(i) - ord('a')

def ck(x, y):
	return int(bin(x)[2:] + bin(y)[2:], 2)
n = fi()
v = ['a', 'e', 'i', 'o', 'u']
dv = {'a': 0, 'e': 1, 'i': 2, 'o': 3, 'u': 4}
fg = {}
for _ in range(n):
	s = si()
	lv = 5
	vc = 0
	for i in range(len(s)):
		if s[i] in v:
			vc += 1
			lv = dv[s[i]]
	if vc not in fg:
		fg[vc] = [[] for j in range(6)]
	fg[vc][lv].append(''.join(s))
r = [[], []]
for i in fg:
	for j in range(6):
		while len(fg[i][j]) > 1:
			r[0].append([fg[i][j][-1], fg[i][j][-2]])
			fg[i][j].pop()
			fg[i][j].pop()
	c = 0
	p = []
	for j in range(6):
		while len(fg[i][j]):
			if c % 2 == 1:
				p.append(fg[i][j][-1])
				fg[i][j].pop()
				r[1].append(p)
				c += 1
				p = []
			else:
				p.append(fg[i][j][-1])
				fg[i][j].pop()
				c += 1
ly = []
while len(r[1]) < 1:
	if len(r[0]) > 1:
		r[1].append(r[0][-1])
		r[0].pop()
	else:
		break
while len(r[0]) >= 1 and len(r[1]) >= 1:
	p = []
	p.append(r[1][-1][0])
	p.append(r[0][-1][0])
	p.append(r[1][-1][1])
	p.append(r[0][-1][1])
	r[0].pop()
	r[1].pop()
	while len(r[1]) < 1:
		if len(r[0]) > 1:
			r[1].append(r[0][-1])
			r[0].pop()
		else:
			break
	ly.append(p)
print(len(ly))
for i in ly:
	print(i[0], i[1])
	print(i[2], i[3])


import sys
import itertools
from collections import defaultdict
vowels = 'aeiou'

def getvowelindex(word):
	count = 0
	for c in word:
		if c in vowels:
			count += 1
			lastvowel = c
	return (count, lastvowel)
n = int(sys.stdin.readline().strip())
words = (line.strip() for line in sys.stdin.readlines())
collected = defaultdict(list)
for word in words:
	collected[getvowelindex(word)].append(word)
rhymepairs = []
normalpairs = []
remaining = defaultdict(list)
for (key, s) in collected.items():
	while bool(s):
		first = s.pop()
		if bool(s):
			second = s.pop()
			rhymepairs.append((first, second))
		else:
			remaining[key[0]].append(first)
for s in remaining.values():
	while bool(s):
		first = s.pop()
		if bool(s):
			normalpairs.append((first, s.pop()))
outputstrings = []
while bool(rhymepairs):
	rhyme = rhymepairs.pop()
	if bool(normalpairs):
		normal = normalpairs.pop()
	elif bool(rhymepairs):
		normal = rhymepairs.pop()
	else:
		break
	outputstrings.append(f'{normal[0]} {rhyme[0]}' + '\n' + f'{normal[1]} {rhyme[1]}')
print(len(outputstrings))
for str in outputstrings:
	print(str)


n = int(input())
s = []
v = 'aeiou'
d1 = {}
for _ in range(n):
	t1 = [*input()]
	t2 = [*filter(lambda x: t1[x] in v, range(len(t1)))]
	s.append(t1 + [len(t2), t1[t2[-1]]])
	if s[-1][-2] in d1:
		if s[-1][-1] in d1[s[-1][-2]]:
			d1[s[-1][-2]][s[-1][-1]].append(s[-1])
		else:
			d1[s[-1][-2]][s[-1][-1]] = [s[-1]]
	else:
		d1[s[-1][-2]] = {s[-1][-1]: [s[-1]]}
d2 = {}
for (i, j) in d1.items():
	d2[i] = {'cd': [], 'sd': []}
	for (k, l) in j.items():
		d2[i]['cd'].extend(l[:len(l) - (len(l) & 1)])
		if len(l) & 1:
			d2[i]['sd'].append(l[-1])
ans = []
for (i, j) in d2.items():
	t = j['sd'][:len(j['sd']) - (len(j['sd']) & 1)]
	for k in range(0, len(t), 2):
		ans.append([t[k], t[k + 1]])
t = len(ans)
l = p = 0
for (i, j) in d2.items():
	k = 0
	while k < len(j['cd']):
		if l < t:
			ans[l].extend([j['cd'][k], j['cd'][k + 1]])
		else:
			break
		k += 2
		l += 1
	while k < len(j['cd']):
		if p % 4 == 0:
			ans.append([])
		ans[-1].append(j['cd'][k])
		p += 1
		k += 1
ans = [*filter(lambda x: len(x) == 4, ans)]
print(len(ans))
for i in ans:
	print(''.join(i[0][:-2]), ''.join(i[2][:-2]))
	print(''.join(i[1][:-2]), ''.join(i[3][:-2]))


from collections import defaultdict
import sys
n = int(input())
sound = 'aeoiu'
mapped_words = {}
for i in range(n):
	c = 0
	l = None
	word = input()
	for ch in word:
		if ch in sound:
			c += 1
			l = ch
	if c not in mapped_words:
		mapped_words[c] = defaultdict(list)
	mapped_words[c][l].append(word)
first_words = []
second_pairs = []
for reg in mapped_words.values():
	fw = []
	for let_v in reg.values():
		if len(let_v) % 2 != 0:
			fw.append(let_v[-1])
			second_pairs.extend(zip(let_v[:len(let_v) // 2], let_v[len(let_v) // 2:-1]))
		else:
			second_pairs.extend(zip(let_v[:len(let_v) // 2], let_v[len(let_v) // 2:]))
	if len(fw) > 1:
		if len(fw) % 2 == 1:
			first_words.extend(zip(fw[:len(fw) // 2], fw[len(fw) // 2:-1]))
		else:
			first_words.extend(zip(fw[:len(fw) // 2], fw[len(fw) // 2:]))
if len(first_words) < len(second_pairs):
	border = len(second_pairs) - (len(second_pairs) + len(first_words)) // 2
	first_words.extend(second_pairs[-border:])
	second_pairs = second_pairs[:-border]
pairs = list(zip(first_words, second_pairs))
print(len(pairs))
for ((f1, f2), (s1, s2)) in pairs:
	print(f1, s1)
	print(f2, s2)


n = int(input())
d = {}
ish = {'a', 'e', 'o', 'i', 'u'}

def last_g(x):
	for el in x[::-1]:
		if el in ish:
			return el
for i in range(n):
	s = input()
	count = s.count('a') + s.count('e') + s.count('o') + s.count('i') + s.count('u')
	if count in d:
		d[count].append(s)
	else:
		d[count] = [s]
firsts = []
seconds = []
for e in d:
	gd = {'a': [], 'e': [], 'o': [], 'i': [], 'u': []}
	pairs = []
	for s in d[e]:
		gd[last_g(s)].append(s)
	for b in gd:
		for i in range(0, len(gd[b]) - 1, 2):
			seconds.append((gd[b][i], gd[b][i + 1]))
		if len(gd[b]) % 2 == 1:
			pairs.append(gd[b][-1])
	for i in range(0, len(pairs) - 1, 2):
		firsts.append((pairs[i], pairs[i + 1]))
q = len(seconds)
m = len(firsts)
if m >= q:
	print(q)
	for i in range(q):
		print(firsts[i][0] + ' ' + seconds[i][0])
		print(firsts[i][1] + ' ' + seconds[i][1])
else:
	print(m + (q - m) // 2)
	for i in range(m):
		print(firsts[i][0] + ' ' + seconds[i][0])
		print(firsts[i][1] + ' ' + seconds[i][1])
	for i in range(m, q - 1, 2):
		print(seconds[i][0] + ' ' + seconds[i + 1][0])
		print(seconds[i][1] + ' ' + seconds[i + 1][1])


n = int(input())
tuples = []
hashMap = {}
used = {}
for _ in range(n):
	word = input()
	noOfVowels = 0
	last = 0
	for i in word:
		if i == 'a' or i == 'e' or i == 'i' or (i == 'o') or (i == 'u'):
			last = i
			noOfVowels += 1
	tuples.append((word, noOfVowels, last))
	if noOfVowels not in hashMap:
		hashMap[noOfVowels] = {}
		hashMap[noOfVowels][last] = []
	elif last not in hashMap[noOfVowels]:
		hashMap[noOfVowels][last] = []
	hashMap[noOfVowels][last].append(word)
CompleteDuos = []
SemiCompleteDuos = []
for SameNoOfVowels in hashMap:
	remaining = []
	for sameLastVowel in hashMap[SameNoOfVowels]:
		while len(hashMap[SameNoOfVowels][sameLastVowel]) >= 2:
			CompleteDuos.append((hashMap[SameNoOfVowels][sameLastVowel].pop(), hashMap[SameNoOfVowels][sameLastVowel].pop()))
		while len(hashMap[SameNoOfVowels][sameLastVowel]) > 0:
			remaining.append(hashMap[SameNoOfVowels][sameLastVowel].pop())
	while len(remaining) >= 2:
		SemiCompleteDuos.append((remaining.pop(), remaining.pop()))
NoOfLyrics = 0
minValue = min(len(CompleteDuos), len(SemiCompleteDuos))
NoOfLyrics = minValue
extra = len(CompleteDuos) - minValue
NoOfLyrics += extra // 2
print(NoOfLyrics)
for i in range(minValue):
	print(SemiCompleteDuos[i][0], CompleteDuos[i][0])
	print(SemiCompleteDuos[i][1], CompleteDuos[i][1])
for j in range(minValue, minValue + extra - 1, 2):
	print(CompleteDuos[j][0], CompleteDuos[j + 1][0])
	print(CompleteDuos[j][1], CompleteDuos[j + 1][1])


n = int(input())
vowels = 'aeoiu'
words = []
vocab1 = {}
i = 0
complete_pairs = []
for _ in range(n):
	word = input()
	words.append(word)
	counter = 0
	last_letter = 'a'
	for letter in word:
		if letter in vowels:
			counter += 1
			last_letter = letter
	if (counter, last_letter) in vocab1:
		vocab1[counter, last_letter].append(i)
	else:
		vocab1[counter, last_letter] = [i]
	if len(vocab1[counter, last_letter]) >= 2:
		complete_pairs.append((vocab1[counter, last_letter].pop(), vocab1[counter, last_letter].pop()))
		if len(vocab1[counter, last_letter]) == 0:
			vocab1.pop((counter, last_letter))
	i += 1
semicomplete_pairs = []
vocab2 = {}
for key in vocab1:
	if key[0] in vocab2:
		vocab2[key[0]].extend(vocab1[key])
	else:
		vocab2[key[0]] = vocab1[key]
	while len(vocab2[key[0]]) >= 2:
		semicomplete_pairs.append((vocab2[key[0]].pop(), vocab2[key[0]].pop()))
	if len(vocab2[key[0]]) == 0:
		vocab2.pop(key[0])
result = []
while len(semicomplete_pairs) >= 1 and len(complete_pairs) >= 1:
	complete_pair = complete_pairs.pop()
	semicomplete_pair = semicomplete_pairs.pop()
	result.append((semicomplete_pair[0], complete_pair[0], semicomplete_pair[1], complete_pair[1]))
while len(complete_pairs) >= 2:
	complete_pair1 = complete_pairs.pop()
	complete_pair2 = complete_pairs.pop()
	result.append((complete_pair1[0], complete_pair2[0], complete_pair1[1], complete_pair2[1]))
print(len(result))
for r in result:
	print('{} {}'.format(words[r[0]], words[r[1]]))
	print('{} {}'.format(words[r[2]], words[r[3]]))


from sys import stdin
s = []
z = int(input())
dict = {}
for t in range(z):
	ss = stdin.readline().strip()
	s.append(ss)
	vow = ''
	got = False
	ct = 0
	for i in range(len(ss) - 1, -1, -1):
		if ss[i] == 'a' or ss[i] == 'e' or ss[i] == 'i' or (ss[i] == 'o') or (ss[i] == 'u'):
			ct += 1
			if not got:
				got = True
				vow = ss[i]
	key = vow + str(ct)
	if key in dict:
		dict[key].append(t)
	else:
		dict[key] = [t]
same = []
dif = {}
for key in dict:
	if len(dict[key]) & 1:
		while len(dict[key]) > 1:
			same.append(dict[key][-1])
			dict[key].pop()
		k = key[1:]
		if k in dif:
			dif[k].append(dict[key][-1])
		else:
			dif[k] = [dict[key][-1]]
		dict[key].pop()
	else:
		while len(dict[key]) > 0:
			same.append(dict[key][-1])
			dict[key].pop()
ans = []
for key in dif:
	if len(dif[key]) & 1:
		dif[key].pop()
	while len(dif[key]) > 0 and len(same) > 1:
		ans.append(dif[key][-1])
		dif[key].pop()
		ans.append(same[-1])
		same.pop()
		ans.append(dif[key][-1])
		dif[key].pop()
		ans.append(same[-1])
		same.pop()
	if len(same) <= 1:
		break
while len(same) > 3:
	ans.append(same[-1])
	ans.append(same[-3])
	ans.append(same[-2])
	ans.append(same[-4])
	same.pop()
	same.pop()
	same.pop()
	same.pop()
print(len(ans) // 4)
for i in range(i, len(ans), 4):
	print(s[ans[i]], s[ans[i + 1]])
	print(s[ans[i + 2]], s[ans[i + 3]])


vowels = 'aeoiu'
d = {}
d2 = {}
n = int(input())
pairs1 = []
pairs2 = []
for i in range(n):
	w = input()
	cnt = 0
	lst = '-'
	for c in w:
		if c in vowels:
			lst = c
			cnt += 1
	key = str(cnt) + lst
	if key in d:
		pairs2.append((w, d[key]))
		del d[key]
	else:
		d[key] = w
for k in d:
	k2 = k[:-1]
	if k2 in d2:
		pairs1.append((d[k], d2[k2]))
		del d2[k2]
	else:
		d2[k2] = d[k]
l2 = len(pairs2)
r1 = min(len(pairs1), l2)
r2 = (l2 - r1) // 2
r2 = r2 if r2 >= 0 else 0
print(r1 + r2)
for i in range(r1):
	print(pairs1[i][0], pairs2[i][0])
	print(pairs1[i][1], pairs2[i][1])
j = r1
while j + 1 < l2:
	print(pairs2[j][0], pairs2[j + 1][0])
	print(pairs2[j][1], pairs2[j + 1][1])
	j += 2


n = int(input())
d = []
for _ in range(n):
	s1 = input()
	s2 = ''
	for c in s1:
		if c in ('a', 'e', 'o', 'i', 'u'):
			s2 += c
	d.append((len(s2), s2[-1], s1))
d.sort(key=lambda x: (x[0], x[1]))
r = []
ost = []
(p_a, p_b, p_c) = (0, '', '')
for (a, b, c) in d:
	if a == p_a and b == p_b:
		r.append([p_c, c])
		(p_a, p_b, p_c) = (0, '', '')
		continue
	if p_a != 0:
		ost.append((p_a, p_b, p_c))
	(p_a, p_b, p_c) = (a, b, c)
if p_a != 0:
	ost.append((p_a, p_b, p_c))
i = 0
(p_a, p_c) = (0, '')
for (a, b, c) in ost:
	if a == p_a and i < len(r):
		r[i].append(p_c)
		r[i].append(c)
		p_a = 0
		i += 1
		continue
	(p_a, p_b, p_c) = (a, b, c)
r_final = r[:i]
for j in range(i, len(r), 2):
	if j < len(r) - 1:
		r[j].extend(r[j + 1])
		r_final.append(r[j])
print(len(r_final))
for g in r_final:
	print(' '.join([g[2], g[0]]))
	print(' '.join([g[3], g[1]]))


n = int(input())
words = []
for i in range(n):
	words.append(input())
num_v = {}
last_v = {}
for i in words:
	cnt = 0
	for j in i:
		if j in ['a', 'e', 'i', 'o', 'u']:
			cnt += 1
	num_v[i] = cnt
	for j in range(len(i) - 1, -1, -1):
		if i[j] in ['a', 'e', 'i', 'o', 'u']:
			break
	last_v[i] = ord(i[j])
words.sort(key=lambda x: 10 ** 6 * num_v[x] + last_v[x])
w_in_second = {}
p_in_second = []
w_in_first = {}
p_in_first = []
for i in range(len(words) - 1):
	if num_v[words[i]] == num_v[words[i + 1]] and last_v[words[i]] == last_v[words[i + 1]]:
		try:
			if w_in_second[i]:
				pass
		except:
			w_in_second[i] = True
			w_in_second[i + 1] = True
			p_in_second.append((i, i + 1))
new = []
for i in range(len(words)):
	try:
		if w_in_second[i]:
			pass
	except:
		new.append(words[i])
for i in range(len(new) - 1):
	if num_v[new[i]] == num_v[new[i + 1]]:
		try:
			if w_in_first[i]:
				pass
		except:
			w_in_first[i] = True
			w_in_first[i + 1] = True
			p_in_first.append((i, i + 1))
p_in_first = [(new[i[0]], new[i[1]]) for i in p_in_first]
p_in_second = [(words[i[0]], words[i[1]]) for i in p_in_second]
while len(p_in_first) < len(p_in_second):
	pair = p_in_second.pop()
	p_in_first.append(pair)
print(min(len(p_in_first), len(p_in_second)))
for i in range(min(len(p_in_first), len(p_in_second))):
	print(p_in_first[i][0], p_in_second[i][0])
	print(p_in_first[i][1], p_in_second[i][1])


N = int(input())
words = [input() for _ in range(N)]
used = [0 for _ in range(N)]

def last_vowel(s):
	for i in range(len(s) - 1, -1, -1):
		if s[i] in 'aeiou':
			return s[i]
	raise RuntimeException('CF BAD')

def count_vowels(s):
	count = 0
	for c in s:
		if c in 'aeiou':
			count += 1
	return count

def key(s):
	count = 0
	last = ''
	for c in s:
		if c in 'aeiou':
			count += 1
			last = c
	return (count, last)
buckets = {}
finalbuckets = {}
for (index, word) in enumerate(words):
	k = key(word)
	if k not in buckets:
		buckets[k] = []
	if k[0] not in finalbuckets:
		finalbuckets[k[0]] = []
	buckets[k].append(index)
	finalbuckets[k[0]].append(index)
fp = []
sp = []
for b in buckets:
	if len(buckets[b]) < 2:
		continue
	for i in range(0, len(buckets[b]) - 1, 2):
		sp.append((buckets[b][i], buckets[b][i + 1]))
		used[buckets[b][i]] = 1
		used[buckets[b][i + 1]] = 1
for b in finalbuckets:
	pair = None
	for word in finalbuckets[b]:
		if used[word]:
			continue
		if pair is None:
			pair = word
		else:
			fp.append((pair, word))
			pair = None
move = max(0, (len(sp) - len(fp)) // 2)
z = list(zip(fp + sp[:move], sp[move:]))
print(len(z))
for ((f0, f1), (s0, s1)) in z:
	print(words[f0], words[s0])
	print(words[f1], words[s1])


GL = set(list('aeiou'))
n = int(input())
di = dict()
tails = dict()
ends = 0
ends_words = []
starts = 0
starts_words = []
for i in range(n):
	word = input()
	counter = 0
	for w in word:
		if w in GL:
			last = w
			counter += 1
	if (last, counter) not in di:
		di[last, counter] = [word]
	else:
		di[last, counter].append(word)
for i in list(di.keys()):
	ends += len(di[i]) // 2 * 2
	while len(di[i]) > 1:
		fir = di[i].pop()
		sec = di[i].pop()
		ends_words.append([fir, sec])
for i in list(di.keys()):
	if di[i] == []:
		continue
	if i[1] in tails:
		starts += 2
		starts_words.append([di[i][0], tails[i[1]]])
		del tails[i[1]]
	else:
		tails[i[1]] = di[i][0]
while len(ends_words) > len(starts_words):
	starts_words.append(ends_words.pop())
print(len(ends_words))
for i in range(len(ends_words)):
	end = ends_words.pop()
	st = starts_words.pop()
	print(st[0], end[0])
	print(st[1], end[1])


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
s = set(['a', 'e', 'i', 'o', 'u'])
n = int(input())
a = list()
e = list()
i = list()
o = list()
u = list()
for j in range(n):
	t = input()
	c = 0
	en = ''
	for k in t:
		if k in s:
			c += 1
			en = k
	if en == 'a':
		a.append((c, en, t))
	elif en == 'e':
		e.append((c, en, t))
	elif en == 'i':
		i.append((c, en, t))
	elif en == 'o':
		o.append((c, en, t))
	elif en == 'u':
		u.append((c, en, t))
end = list()
start = list()
a.sort()
a.append((0, 'a', 'a'))
j = 1
while j < len(a):
	if a[j][0] == a[j - 1][0]:
		end.append(a[j][2])
		end.append(a[j - 1][2])
		j += 2
	else:
		start.append((a[j - 1][0], a[j - 1][2]))
		j += 1
e.sort()
e.append((0, 'a', 'a'))
j = 1
while j < len(e):
	if e[j][0] == e[j - 1][0]:
		end.append(e[j][2])
		end.append(e[j - 1][2])
		j += 2
	else:
		start.append((e[j - 1][0], e[j - 1][2]))
		j += 1
i.sort()
i.append((0, 'a', 'a'))
j = 1
while j < len(i):
	if i[j][0] == i[j - 1][0]:
		end.append(i[j][2])
		end.append(i[j - 1][2])
		j += 2
	else:
		start.append((i[j - 1][0], i[j - 1][2]))
		j += 1
o.sort()
o.append((0, 'a', 'a'))
j = 1
while j < len(o):
	if o[j][0] == o[j - 1][0]:
		end.append(o[j][2])
		end.append(o[j - 1][2])
		j += 2
	else:
		start.append((o[j - 1][0], o[j - 1][2]))
		j += 1
u.sort()
u.append((0, 'a', 'a'))
j = 1
while j < len(u):
	if u[j][0] == u[j - 1][0]:
		end.append(u[j][2])
		end.append(u[j - 1][2])
		j += 2
	else:
		start.append((u[j - 1][0], u[j - 1][2]))
		j += 1
l = len(end)
start.sort()
j = 1
start.append((0, 'a'))
while j < len(start):
	if start[j][0] == start[j - 1][0]:
		end.append(start[j][1])
		end.append(start[j - 1][1])
		j += 2
	else:
		j += 1
ct = len(end) - 2
j = 1
res = list()
while j < l:
	if ct > j:
		res.append((end[ct + 1], end[j - 1]))
		res.append((end[ct], end[j]))
		j += 2
		ct -= 2
	else:
		break
print(len(res) // 2)
for j in res:
	print(*j)


from sys import stdin, stdout
n = int(stdin.readline())
vowels = {'a', 'e', 'o', 'i', 'u'}
words = []
for i in range(n):
	words.append(stdin.readline()[:-1])
all_pairs = {}
sec_pairs = {}
for item in words:
	(cnt, last) = (0, -1)
	for i in item:
		if i in vowels:
			cnt += 1
			last = i
	if cnt not in all_pairs:
		all_pairs[cnt] = {item: 1}
	elif item in all_pairs[cnt]:
		all_pairs[cnt][item] += 1
	else:
		all_pairs[cnt][item] = 1
	if cnt not in sec_pairs:
		sec_pairs[cnt] = {last: {item: 1}}
	elif last not in sec_pairs[cnt]:
		sec_pairs[cnt][last] = {item: 1}
	elif item not in sec_pairs[cnt][last]:
		sec_pairs[cnt][last][item] = 1
	else:
		sec_pairs[cnt][last][item] += 1
s_p = 0
s_list = []
for cnt in sec_pairs.keys():
	for last in sec_pairs[cnt].keys():
		s = 0
		cnt_l_list = []
		for word in sec_pairs[cnt][last].keys():
			s += sec_pairs[cnt][last][word]
			cnt_l_list += sec_pairs[cnt][last][word] * [word]
		s_p += s // 2
		s_list.extend(cnt_l_list[:2 * (s // 2)])
all_p = 0
for cnt in all_pairs.keys():
	s = 0
	for word in all_pairs[cnt].keys():
		s += all_pairs[cnt][word]
	all_p += s // 2
ans = min(s_p, all_p // 2)
s_list = s_list[:2 * ans]
for item in s_list:
	cnt = 0
	for i in item:
		if i in vowels:
			cnt += 1
	all_pairs[cnt][item] -= 1
f_list = []
for cnt in all_pairs.keys():
	cnt_l = []
	s = 0
	for word in all_pairs[cnt].keys():
		cnt_l += all_pairs[cnt][word] * [word]
		s += all_pairs[cnt][word]
	f_list.extend(cnt_l[:2 * (s // 2)])
f_list = f_list[:2 * ans]
print(ans)
for i in range(ans):
	stdout.write(f_list[2 * i] + ' ' + s_list[2 * i] + '\n')
	stdout.write(f_list[2 * i + 1] + ' ' + s_list[2 * i + 1] + '\n')


n = int(input())
arr = []
dict1 = {}
for i in range(n):
	s = str(input())
	s1 = 'aeiou'
	count = 0
	second = -1
	for j in s:
		if j in s1:
			count += 1
			second = j
	indexes = s1.index(second)
	try:
		dict1[count].append((indexes, s))
	except:
		KeyError
		dict1[count] = [(indexes, s)]
for i in dict1.keys():
	dict1[i].sort()
first = []
second = []
count1 = 0
count2 = 0
ans = 0
for i in dict1.keys():
	j = 0
	prev = ''
	while j < len(dict1[i]) - 1:
		if dict1[i][j][0] == dict1[i][j + 1][0]:
			second.append((dict1[i][j][1], dict1[i][j + 1][1]))
			j += 2
		else:
			if prev != '':
				first.append((prev, dict1[i][j][1]))
				prev = ''
			else:
				prev = dict1[i][j][1]
			j += 1
	if j == len(dict1[i]) - 1 and prev != '':
		first.append((prev, dict1[i][j][1]))
ansarr = []
i1 = 0
j1 = 0
ans = 0
while i1 < len(first) and j1 < len(second):
	ansarr.append(first[i1][0])
	ansarr.append(second[j1][0])
	ansarr.append(first[i1][1])
	ansarr.append(second[j1][1])
	ans += 1
	i1 += 1
	j1 += 1
while j1 < len(second) - 1:
	ansarr.append(second[j1][0])
	ansarr.append(second[j1 + 1][0])
	ansarr.append(second[j1][1])
	ansarr.append(second[j1 + 1][1])
	ans += 1
	j1 += 2
print(ans)
print(*ansarr)


n = int(input())
lyrics = []
seq = {}
vowels = ['a', 'e', 'i', 'o', 'u']
for i in range(n):
	tmp = input()
	lyrics.append(tmp)
	cnt = 0
	last = '-'
	for s in tmp:
		if s in vowels:
			last = vowels.index(s)
			cnt += 1
	try:
		seq[cnt]
	except KeyError:
		seq[cnt] = [[] for x in range(5)]
	seq[cnt][last].append(i)
odd = []
pair = []
for (key, val) in seq.items():
	for x in val:
		i = len(x)
		if i % 2 == 1:
			odd.append(x[-1])
			x = x[:-1]
		pair.extend(x)
	if len(odd) % 2 == 1:
		odd = odd[:-1]
lo = len(odd) // 2
lp = len(pair) // 2
m = min((lo + lp) // 2, lp)
print(m)
ans = [-1 for x in range(m * 4)]
for i in range(len(odd)):
	try:
		ans[i * 2] = odd[i]
	except IndexError:
		break
cnt = 0
i = 0
while i < m * 4:
	if i < len(odd) * 2:
		if ans[i] == -1:
			ans[i] = pair[cnt]
			cnt += 1
	else:
		ans[i] = pair[cnt]
		ans[i + 1] = pair[cnt + 2]
		ans[i + 2] = pair[cnt + 1]
		ans[i + 3] = pair[cnt + 3]
		cnt += 4
		i += 3
	i += 1
for i in range(len(ans) // 2):
	print(lyrics[ans[2 * i]], lyrics[ans[2 * i + 1]])


from collections import defaultdict

def gg(word):
	c = 0
	for i in word:
		if i in gl:
			c += 1
	return c

def lv(word):
	for i in word[::-1]:
		if i in gl:
			return i
n = int(input())
d = defaultdict(lambda : defaultdict(list))
gl = 'aeoiu'
for i in range(n):
	s = input()
	d[gg(s)][lv(s)].append(s)
pw = []
vw = []
for i in d.values():
	pwtc = []
	for j in i.values():
		if len(j) % 2 == 1:
			if len(j) >= 2:
				vw += j[:-1]
			pwtc.append(j[-1])
		else:
			vw += j
	if len(pwtc) >= 2:
		if len(pwtc) % 2 == 1:
			pw += pwtc[:-1]
		else:
			pw += pwtc
while len(vw) > len(pw):
	pw.append(vw.pop())
	pw.append(vw.pop())
print(len(vw) // 2)
for i in range(min(len(vw), len(pw))):
	print(pw[i], vw[i])


from collections import Counter
n = int(input())
d = {}
cnt = Counter()
for _ in range(n):
	w = input()
	last_vow = ''
	nb = 0
	for i in w:
		if i in 'aeiou':
			nb += 1
			last_vow = i
	if nb in d:
		if last_vow in d[nb]:
			d[nb][last_vow].append(w)
		else:
			d[nb][last_vow] = [w]
	else:
		d[nb] = {last_vow: [w]}
	cnt.update([nb])
only_first_word = []
second_words = []
for i in d:
	tmp = []
	for j in d[i]:
		if not cnt[i] > 1:
			break
		if len(d[i][j]) % 2:
			tmp.append(d[i][j][0])
			second_words += d[i][j][1:]
		else:
			second_words += d[i][j]
	if len(tmp) % 2:
		tmp.pop()
	only_first_word += tmp
n = max(min(len(only_first_word), len(second_words)), 0)
ans = []
for i in range(n):
	ans.append((only_first_word[i], second_words[i]))
N = len(second_words)
for i in range(n, N, 4):
	if i + 3 >= N:
		break
	ans.append((second_words[i], second_words[i + 2]))
	ans.append((second_words[i + 1], second_words[i + 3]))
print(len(ans) // 2)
for x in ans:
	print(x[0], x[1])


import sys
num = int(input())
vowels = 'aeiou'
numvdic = {}
valdic = {}
inpt = []
for i in range(num):
	word = sys.stdin.readline()
	inpt.append(word.strip())
	a = sum([word.count(vowels[i]) for i in range(5)])
	ind = -1
	while True:
		b = vowels.find(word[ind])
		if b != -1:
			break
		ind -= 1
	val = a << 3 | b
	if a in numvdic:
		numvdic[a].add(i)
	else:
		numvdic[a] = {i}
	if val in valdic:
		valdic[val].add(i)
	else:
		valdic[val] = {i}
bound = 0
for st in numvdic.values():
	bound += len(st) // 2
bound //= 2
ids = list(valdic.values())
data = []
used = set()
for i in range(len(ids)):
	st = ids[i]
	while len(st) > 1 and len(data) < bound:
		a = st.pop()
		b = st.pop()
		data.append((a, b))
		used.add(a)
		used.add(b)
	if len(data) == bound:
		break
print(len(data))
ind = len(data) - 1
for st in numvdic.values():
	temp = []
	while len(st) != 0:
		if ind == -1:
			break
		q = st.pop()
		if q not in used:
			temp.append(q)
			if len(temp) == 2:
				print(inpt[temp[0]], inpt[data[ind][0]])
				print(inpt[temp[1]], inpt[data[ind][1]])
				ind -= 1
				temp = []


import sys, math

def read_int():
	return int(sys.stdin.readline().strip())

def read_int_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def read_string():
	return sys.stdin.readline().strip()

def read_string_list(delim=' '):
	return sys.stdin.readline().strip().split(delim)

def print_list(l):
	print(' '.join(map(str, l)))
vowels = ['a', 'e', 'i', 'o', 'u']

def count_vowels(s):
	global vowels
	out = 0
	for _s in s:
		if _s in vowels:
			out += 1
	return out

def last_vowel(s):
	global vowels
	out = None
	for _s in s:
		if _s in vowels:
			out = _s
	return out
n = read_int()
inputs = []
for _ in range(n):
	inputs.append(read_string())
main_dik = {}
for s in inputs:
	a = count_vowels(s)
	l = last_vowel(s)
	if a not in main_dik:
		main_dik[a] = {}
	if l not in main_dik[a]:
		main_dik[a][l] = []
	main_dik[a][l].append(s)
complete_duos = []
semi_duos = []
for k in main_dik:
	for c in main_dik[k]:
		l = main_dik[k][c]
		while len(l) >= 2:
			complete_duos.append((l.pop(), l.pop()))
	remaininig = []
	for c in main_dik[k]:
		l = main_dik[k][c]
		remaininig.extend(l)
	while len(remaininig) >= 2:
		semi_duos.append((remaininig.pop(), remaininig.pop()))
lyrics = []
while len(complete_duos) > 0 and len(semi_duos) > 0:
	_semi = semi_duos.pop()
	_compl = complete_duos.pop()
	lyrics.append((_semi[0], _compl[0]))
	lyrics.append((_semi[1], _compl[1]))
while len(complete_duos) >= 2:
	_duo0 = complete_duos.pop()
	_duo1 = complete_duos.pop()
	lyrics.append((_duo0[0], _duo1[0]))
	lyrics.append((_duo0[1], _duo1[1]))
print(len(lyrics) // 2)
for l in lyrics:
	print(l[0], l[1])


vowel = ['a', 'e', 'i', 'o', 'u']
rare = []
common = []
res = []
stor = {}

def ins(w):
	(cnum, lc) = (0, '')
	for c in w:
		for v in vowel:
			if c == v:
				cnum += 1
				lc = c
				break
	stor.setdefault(cnum, {})
	stor[cnum].setdefault(lc, [])
	stor[cnum][lc].append(w)

def srt():
	for N in stor:
		cstr = rstr = ''
		for C in stor[N]:
			for st in stor[N][C]:
				if rstr == '':
					rstr = st
				else:
					rare.append((st, rstr))
					rstr = ''
			if cstr != '' and rstr != '':
				common.append((cstr, rstr))
				cstr = rstr = ''
			if rstr != '':
				cstr = rstr
				rstr = ''

def mkstn():
	while len(common):
		if not len(rare):
			break
		cp = common.pop()
		rp = rare.pop()
		res.append(cp[0] + ' ' + rp[0] + '\n' + cp[1] + ' ' + rp[1])
	while len(rare):
		if len(rare) >= 2:
			(rp1, rp2) = (rare.pop(), rare.pop())
			res.append(rp1[0] + ' ' + rp2[0] + '\n' + rp1[1] + ' ' + rp2[1])
		else:
			break
T = int(input())
for t in range(T):
	ins(input())
srt()
mkstn()
print(len(res))
for S in res:
	print(S)


from collections import deque
if True:
	N = int(input())
	X = {}

	def calc(t):
		c = 0
		v = 0
		for u in reversed(t):
			if u == 'a' or u == 'i' or u == 'u' or (u == 'e') or (u == 'o'):
				if c == 0:
					if u == 'a':
						v = 0
					if u == 'i':
						v = 1
					if u == 'u':
						v = 2
					if u == 'e':
						v = 3
					if u == 'o':
						v = 4
				c += 1
		if c not in X:
			X[c] = [[] for _ in range(5)]
		X[c][v].append(t)
	for _ in range(N):
		calc(input())
else:
	N = 14
	X = [[[], [], [], [], []], [['am', 'that'], ['this', 'is', 'first', 'mcdics', 'i'], [], ['the'], ['wow']], [[], [], ['round', 'proud'], [], []], [['hooray'], [], ['about'], [], []], [[], [], [], ['codeforces'], []]]
A = 0
B = 0
Q = deque([])
for i in X:
	a = sum([len(x) // 2 for x in X[i]]) * 2
	b = sum([len(x) for x in X[i]]) // 2 * 2 - a
	A += a
	B += b
	for j in range(5):
		while len(X[i][j]) >= 2:
			deque.appendleft(Q, X[i][j].pop())
			deque.appendleft(Q, X[i][j].pop())
	for j in range(5):
		while len(X[i][j]) >= 1 and b > 0:
			deque.append(Q, X[i][j].pop())
			b -= 1
ans = min(A // 2, (A + B) // 4)
print(ans)
for _ in range(ans):
	print(Q.pop(), Q.popleft())
	print(Q.pop(), Q.popleft())


n = int(input())
ns = []
d = {}

def nm(s):
	ans = 0
	lst = None
	for c in s:
		if c == 'a' or c == 'e' or c == 'i' or (c == 'o') or (c == 'u'):
			lst = c
			ans += 1
	return (ans, lst)
for i in range(n):
	s = input()
	x = nm(s)
	if x not in d:
		d[x] = []
	d[x].append(s)
ans2 = []
ans1 = []
dn = {}
for x in d.keys():
	ans2 += list(d[x])
	(num, lst) = x
	if len(ans2) % 2 == 1:
		y = ans2.pop()
		if num not in dn:
			dn[num] = []
		dn[num].append(y)
for num in dn.keys():
	ans1 += list(dn[num])
	if len(ans1) % 2 == 1:
		ans1.pop()
if len(ans1) > len(ans2):
	print(len(ans2) // 2)
	for i in range(len(ans2)):
		print(ans1[i], ans2[i])
else:
	ans = []
	l1 = len(ans1)
	l2 = len(ans2)
	for i in range(l1):
		ans.append(ans1[i] + ' ' + ans2[i])
	i = l1
	while i + 3 < l2:
		ans.append(ans2[i] + ' ' + ans2[i + 2])
		ans.append(ans2[i + 1] + ' ' + ans2[i + 3])
		i += 4
	print(len(ans) // 2)
	for c in ans:
		print(c)


vowels = ['a', 'e', 'i', 'o', 'u']

class word:

	def __init__(self, p):
		o = [int(p[i] in vowels) for i in range(len(p))]
		self.nov = sum(o)
		o.reverse()
		self.lastvow = p[len(p) - 1 - o.index(1)]
n = int(input())
ug = {}
max_keys = 0
com_duos = []
for i in range(n):
	here = input()
	wd = word(here)
	imp = wd.nov
	if imp > max_keys:
		for i in range(max_keys + 1, imp + 1):
			ug[i] = [[], [], [], [], []]
		max_keys = imp
	see = ug[imp][vowels.index(wd.lastvow)]
	if see == []:
		see.append(here)
	else:
		com_duos.append([see.pop(), here])
incom_duos = []
for key in ug:
	vess = ''
	for v in range(5):
		if ug[key][v] != []:
			if vess == '':
				vess = ug[key][v][0]
			else:
				incom_duos += [[vess, ug[key][v][0]]]
				vess = ''
(x, y) = (len(com_duos), len(incom_duos))
m = min(x, (x + y) // 2)
print(m)
for i in range(m):
	com = com_duos.pop()
	if incom_duos != []:
		incom = incom_duos.pop()
	else:
		incom = com_duos.pop()
	print(incom[0], com[0])
	print(incom[1], com[1])


from collections import defaultdict
vow = 'aeoiu'

def vowels(word):
	c = 0
	for i in word:
		if i in vow:
			c += 1
	return c

def last_vov(word):
	for i in reversed(word):
		if i in vow:
			return i
mp = defaultdict(lambda : defaultdict(list))
for _ in range(int(input())):
	w = input()
	mp[vowels(w)][last_vov(w)].append(w)
second_w = []
first_w = []
for last_v_dict in mp.values():
	first_w_t = []
	for words in last_v_dict.values():
		if len(words) % 2 == 1:
			if len(words) > 2:
				second_w += words[:-1]
			first_w_t.append(words[-1])
		else:
			second_w += words
	if len(first_w_t) >= 2:
		if len(first_w_t) % 2 == 1:
			first_w += first_w_t[:-1]
		else:
			first_w += first_w_t
while len(second_w) > len(first_w):
	first_w.append(second_w.pop())
	first_w.append(second_w.pop())
print(len(second_w) // 2)
for (i, word) in enumerate(second_w):
	print(first_w[i], word)


def fun(string):
	last = ''
	amount = 0
	saw = False
	r = len(string)
	for i in range(r - 1, -1, -1):
		if string[i] in gay:
			amount += 1
			if not saw:
				saw = True
				last = string[i]
	return (amount, last)

def main():
	n = int(input())
	words = {}
	sizesandlasts = {}
	sizes = set()
	for i in range(n):
		s = input()
		pair = (size, last) = fun(s)
		sizes.add(size)
		words[s] = pair
		if pair not in sizesandlasts:
			sizesandlasts[pair] = []
		sizesandlasts[pair].append(s)
	second = []
	first = {}
	for length in sizes:
		for ch in gay:
			text = sizesandlasts.get((length, ch), [])
			for val in range(len(text) // 2):
				second.append([text.pop(), text.pop()])
			if len(text) > 0:
				size = words[text[0]][0]
				if size not in first:
					first[size] = []
				first[size].append(text.pop())
	ans = []
	for size in first:
		if len(second) == 0:
			break
		else:
			while len(first[size]) > 1 and len(second) > 0:
				ans.append([[first[size].pop(), first[size].pop()], second.pop()])
	while len(second) > 1:
		ans.append([second.pop(), second.pop()])
	print(len(ans))
	for i in range(len(ans)):
		print('{} {}'.format(ans[i][0][0], ans[i][1][0]))
		print('{} {}'.format(ans[i][0][1], ans[i][1][1]))
gay = set()
for char in ['a', 'e', 'o', 'i', 'u']:
	gay.add(char)
main()


n = int(input())
words = {}

def getKey(word):
	vowels = 'aeiou'
	nVowels = 0
	indexLast = -1
	for (i, l) in enumerate(word):
		if l in vowels:
			nVowels += 1
			lVowel = l
	return (str(lVowel), str(nVowels))
for i in range(n):
	s = input()
	(index, num) = getKey(s)
	if num not in words:
		words[num] = {}
	if index not in words[num]:
		words[num][index] = []
	words[num][index].append(s)
nComp = []
nSemi = []
for i in words.values():
	nRem = []
	for j in i.values():
		for k in range(0, len(j) - 1, 2):
			nComp.append((j[k], j[k + 1]))
		if len(j) % 2 != 0:
			nRem.append(j[-1])
	for j in range(0, len(nRem) - 1, 2):
		nSemi.append((nRem[j], nRem[j + 1]))
lComp = len(nComp)
lSemi = len(nSemi)
minim = min(lComp, lSemi)
rem = (lComp - minim) // 2
print(minim + rem)
for i in range(minim):
	for j in range(2):
		print(nSemi[i][j], nComp[i][j])
for i in range(rem):
	for j in range(2):
		print(nComp[minim + 2 * i][j], nComp[minim + 2 * i + 1][j])


VOWELS = ('a', 'e', 'i', 'o', 'u')

def main():
	buf = input()
	n = int(buf)
	s = []
	for i in range(n):
		buf = input()
		s.append(buf)
	word_info = []
	for (i, x) in enumerate(s):
		vowel_count = 0
		last_vowel = None
		for c in x:
			if c in VOWELS:
				vowel_count += 1
				last_vowel = c
		word_info.append((i, vowel_count, last_vowel))
	word_info.sort(key=lambda x: (x[1], x[2]))
	word_pair = []
	word_pair_first_only = []
	last_vowel_count = 0
	last_last_vowel = None
	last_word = None
	last_word_leftover = None
	for (i, x) in enumerate(word_info):
		if x[1] > last_vowel_count:
			if last_word and last_word_leftover:
				word_pair_first_only.append((last_word, last_word_leftover))
			last_word_leftover = None
			last_word = None
			last_vowel_count = x[1]
			last_last_vowel = x[2]
		if x[2] != last_last_vowel:
			if last_word:
				if last_word_leftover:
					word_pair_first_only.append((last_word, last_word_leftover))
					last_word_leftover = None
				else:
					last_word_leftover = last_word
				last_word = None
			last_last_vowel = x[2]
		if last_word:
			word_pair.append((last_word, x))
			last_word = None
		else:
			last_word = x
	if last_word and last_word_leftover:
		word_pair_first_only.append((last_word, last_word_leftover))
	lyrics = []
	first_only_pointer = 0
	last_word_pair = None
	for (i, x) in enumerate(word_pair):
		if first_only_pointer < len(word_pair_first_only):
			last_word_pair = word_pair_first_only[first_only_pointer]
			first_only_pointer += 1
		if last_word_pair:
			lyrics.append((last_word_pair, x))
			last_word_pair = None
		else:
			last_word_pair = x
	print(len(lyrics))
	for x in lyrics:
		print(s[x[0][0][0]], s[x[1][0][0]])
		print(s[x[0][1][0]], s[x[1][1][0]])

def __starting_point():
	main()
__starting_point()


def is_vowel(c):
	return c == 'a' or c == 'e' or c == 'i' or (c == 'o') or (c == 'u')

def count_vowels(word):
	ans = 0
	last_vowel = ''
	for i in range(len(word)):
		if is_vowel(word[i]):
			last_vowel = word[i]
			ans += 1
	return (ans, last_vowel)
N = int(input())
m = {}
for n in range(N):
	word = input()
	(num_vowels, last_vowel) = count_vowels(word)
	if not num_vowels in m:
		m[num_vowels] = {}
	if not last_vowel in m[num_vowels]:
		m[num_vowels][last_vowel] = []
	m[num_vowels][last_vowel].append(word)
tot_pair = []
semi_pair = []
for (key_num, value_num) in m.items():
	for (key_last, value_last) in value_num.items():
		while len(value_last) >= 2:
			tot_pair.append(value_last[-1])
			tot_pair.append(value_last[-2])
			value_last.pop()
			value_last.pop()
		while len(value_last) > 0:
			semi_pair.append(value_last[-1])
			value_last.pop()
	if len(semi_pair) % 2 == 1:
		semi_pair.pop()
ans = []
count = 0
while len(tot_pair) >= 2 and len(semi_pair) >= 2:
	line_1 = [semi_pair[-1], tot_pair[-1]]
	line_2 = [semi_pair[-2], tot_pair[-2]]
	semi_pair.pop()
	semi_pair.pop()
	tot_pair.pop()
	tot_pair.pop()
	lyric = [line_1, line_2]
	ans.append(lyric)
	count += 1
while len(tot_pair) >= 4:
	line_1 = [tot_pair[-3], tot_pair[-1]]
	line_2 = [tot_pair[-4], tot_pair[-2]]
	tot_pair.pop()
	tot_pair.pop()
	tot_pair.pop()
	tot_pair.pop()
	lyric = [line_1, line_2]
	ans.append(lyric)
	count += 1
print(count)
for lyric in ans:
	for line in lyric:
		print(line[0], line[1])


import sys
import math
from collections import defaultdict

def get_vowel(s):
	n = len(s)
	last = ''
	vow = ['a', 'e', 'i', 'o', 'u']
	count = 0
	for i in range(n):
		if s[i] in vow:
			count += 1
			last = s[i]
	return (count, last)
n = int(sys.stdin.readline())
dica = defaultdict(list)
dic = defaultdict(list)
(used, count) = (defaultdict(int), defaultdict(int))
for _ in range(n):
	s = sys.stdin.readline()[:-1]
	(num, last) = get_vowel(s)
	dica[last + str(num)].append(s)
	dic[num].append(s)
	count[s] += 1
(word1, word2, word3, word4) = ([], [], [], [])
for i in dica:
	n = len(dica[i])
	if n > 1:
		j = 0
		while j < n - 1:
			word2.append(dica[i][j])
			used[dica[i][j]] += 1
			j += 1
			word4.append(dica[i][j])
			used[dica[i][j]] += 1
			j += 1
for i in dic:
	n = len(dic[i])
	if n > 1:
		j = 0
		l = []
		while j < n:
			if used[dic[i][j]] < count[dic[i][j]]:
				l.append(dic[i][j])
				used[dic[i][j]] += 1
			j += 1
		if len(l) > 1:
			j = 0
			m = len(l)
			while j < m - 1:
				word1.append(l[j])
				j += 1
				word3.append(l[j])
				j += 1
ans = len(word1)
n = len(word2) - len(word1)
if n > 0:
	n = n // 2
	ans += n
	print(ans)
	for i in range(len(word1)):
		print(word1[i], word2[i])
		print(word3[i], word4[i])
	j = len(word1)
	while j < len(word2) - 1:
		print(word2[j], word2[j + 1])
		print(word4[j], word4[j + 1])
		j += 2
else:
	ans = min(len(word1), len(word2))
	print(ans)
	for i in range(len(word2)):
		print(word1[i], word2[i])
		print(word3[i], word4[i])


from collections import namedtuple

def f(word):
	consonants = ['a', 'e', 'o', 'i', 'u']
	s = 0
	last = ''
	for i in word:
		if i in consonants:
			s += 1
			last = i
	return (s, last)
Word = namedtuple('Word', 'text n_letters last_letter')
d = {'a': dict(), 'e': dict(), 'o': dict(), 'i': dict(), 'u': dict()}
n = int(input())
ans = []
first_good_words = []
second_good_words = []
for i in range(n):
	word = input()
	(n_letters, last_letter) = f(word)
	s = Word(word, n_letters, last_letter)
	d[last_letter].setdefault(n_letters, []).append(word)
	if len(d[last_letter][n_letters]) >= 2:
		second_good_words.append((d[last_letter][n_letters].pop(0), d[last_letter][n_letters].pop(0)))
new_d = {}
for dic in d.values():
	for (key, lis) in dic.items():
		if key in new_d:
			new_d[key] += lis
			if len(new_d[key]) >= 2:
				first_good_words.append((new_d[key].pop(0), new_d[key].pop(0)))
		else:
			new_d[key] = lis
while len(second_good_words) - 1 > len(first_good_words):
	first_good_words.append(second_good_words.pop())
s = list(zip(second_good_words, first_good_words))
print(len(s))
for ((a2, b2), (a1, b1)) in s:
	print(a1, a2)
	print(b1, b2)


n = int(input())
dic = {}
first_res = []
sec_res = []
for _ in range(n):
	t = input()
	key = t.count('e') + t.count('u') + t.count('o') + t.count('i') + t.count('a')
	temp = max(t.rfind('e'), t.rfind('u'), t.rfind('o'), t.rfind('i'), t.rfind('a'))
	if key not in dic.keys():
		dic[key] = {}
		dic[key][t[temp]] = [t]
	elif t[temp] not in dic[key].keys():
		dic[key][t[temp]] = [t]
	else:
		dic[key][t[temp]].append(t)
for (key, key2) in dic.items():
	temp = []
	for (vowel, words) in key2.items():
		while len(words) >= 2:
			a = words.pop()
			b = words.pop()
			sec_res.append((a, b))
		if len(words):
			temp.append(words.pop())
	while len(temp) >= 2:
		a = temp.pop()
		b = temp.pop()
		first_res.append((a, b))
if len(sec_res) <= len(first_res):
	print(len(sec_res))
	for i in range(len(sec_res)):
		print(first_res[i][0], sec_res[i][0])
		print(first_res[i][1], sec_res[i][1])
else:
	print(len(first_res) + (len(sec_res) - len(first_res)) // 2)
	j = -1
	for i in range(len(first_res)):
		print(first_res[i][0], sec_res[i][0])
		print(first_res[i][1], sec_res[i][1])
		j = i
	while j + 2 < len(sec_res):
		print(sec_res[j + 1][0], sec_res[j + 2][0])
		print(sec_res[j + 1][1], sec_res[j + 2][1])
		j += 2


from collections import defaultdict
n = int(input())
VOWELS = {'a', 'e', 'o', 'i', 'u'}

def print_words(words):
	for (length, len_collection) in words.items():
		print(length)
		for (letter, letter_set) in len_collection.by_letter.items():
			if not letter_set:
				continue
			print(letter, {word.value for word in letter_set})
		print('remtants ', {word.value for word in len_collection.remnants})
		print()

class Word:

	def __init__(self, value):
		self.value = value
		(self.vowels, self.last_vowel) = self._process(value)

	@staticmethod
	def _process(word):
		total = 0
		last = None
		for letter in word:
			if letter in VOWELS:
				last = letter
				total += 1
		return (total, last)

	def __hash__(self):
		return hash(self.value)

class Line:

	def __init__(self):
		self.word1 = None
		self.word2 = None

	def __str__(self):
		return '{} {}'.format(self.word1, self.word2)

class Lyric:

	def __init__(self):
		self.line1 = Line()
		self.line2 = Line()

	def set_first_words(self, word1: Word, word2: Word):
		self.line1.word1 = word1.value
		self.line2.word1 = word2.value

	def set_last_words(self, word1: Word, word2: Word):
		self.line1.word2 = word1.value
		self.line2.word2 = word2.value

	def __str__(self):
		return '{}\n{}'.format(self.line1, self.line2)

class LenWordCollection:

	def __init__(self):
		self.by_letter = defaultdict(set)
		self.remnants = set()
WORDS = defaultdict(LenWordCollection)
words = [Word(input()) for i in range(n)]
for word in words:
	vowels = word.vowels
	last_vowel = word.last_vowel
	WORDS[vowels].by_letter[last_vowel].add(word)
good_pairs = 0
endings_pairs = 0
for len_word in WORDS.values():
	for letter_set in len_word.by_letter.values():
		pairs = len(letter_set) // 2
		good_pairs += pairs
		endings_pairs += pairs
		if len(letter_set) % 2 == 1:
			word = letter_set.pop()
			len_word.remnants.add(word)
	good_pairs += len(len_word.remnants) // 2
if endings_pairs * 2 <= good_pairs:
	ans = endings_pairs
else:
	ans = good_pairs // 2
print(ans)

def fill_last_word():
	for len_word in WORDS.values():
		for letter_set in len_word.by_letter.values():
			while len(letter_set) >= 2:
				word1 = letter_set.pop()
				word2 = letter_set.pop()
				lyric = Lyric()
				lyric.set_last_words(word1, word2)
				lyrics.append(lyric)
				if len(lyrics) == ans:
					return

def fill_first_word():
	index = 0
	for len_word in WORDS.values():
		for letter_set in len_word.by_letter.values():
			while len(letter_set) >= 2:
				word1 = letter_set.pop()
				word2 = letter_set.pop()
				lyric = lyrics[index]
				lyric.set_first_words(word1, word2)
				index += 1
				if index == ans:
					return
		while len(len_word.remnants) >= 2:
			word1 = len_word.remnants.pop()
			word2 = len_word.remnants.pop()
			lyric = lyrics[index]
			lyric.set_first_words(word1, word2)
			index += 1
			if index == ans:
				return
lyrics = []
if ans:
	fill_last_word()
	fill_first_word()
for lyric in lyrics:
	print(str(lyric))


def countvowels(s):
	count = 0
	for i in s:
		if i in vowels:
			count += 1
			last = i
	return (count, last)
n = int(input())
a = []
count = {}
vowels = {'a', 'e', 'i', 'o', 'u'}
last = {}
for i in range(n):
	s = input()
	(d, l) = countvowels(s)
	if d not in count:
		count[d] = [s]
	else:
		count[d].append(s)
	last[s] = l
lword = []
fword = []
for i in count:
	d = {}
	for j in count[i]:
		if last[j] not in d:
			d[last[j]] = j
		else:
			lword.append((j, d[last[j]]))
			del d[last[j]]
	if len(d) > 1:
		k = []
		for j in d:
			k.append(d[j])
		for j in range(0, len(k) - 1, 2):
			fword.append((k[j], k[j + 1]))
if len(fword) <= len(lword):
	ans = len(fword) + (len(lword) - len(fword)) // 2
	print(ans)
	for i in range(len(fword)):
		print(fword[i][0], lword[i][0])
		print(fword[i][1], lword[i][1])
	for i in range(len(fword), len(lword) - 1, 2):
		print(lword[i][0], lword[i + 1][0])
		print(lword[i][1], lword[i + 1][1])
else:
	ans = len(lword)
	print(ans)
	for i in range(ans):
		print(fword[i][0], lword[i][0])
		print(fword[i][1], lword[i][1])


from sys import stdin, setrecursionlimit
setrecursionlimit(10 ** 7)

def iin():
	return int(stdin.readline())

def lin():
	return list(map(int, stdin.readline().split()))

def main():
	n = iin()
	dc = {}
	vowel = {'a', 'e', 'i', 'o', 'u'}
	a1 = []
	for i in range(n):
		w = input()
		a1.append(w)
		(ch, v) = (0, 'z')
		for j in w:
			if j in vowel:
				ch += 1
				v = j
		try:
			dc[ch, v].append(i)
		except:
			dc[ch, v] = [i]
	left = {}
	select = []
	ans = []
	for i in dc:
		j = 0
		l = len(dc[i])
		while j < l - 1:
			select.append([dc[i][j], dc[i][j + 1]])
			j += 2
		if l % 2:
			(x, y) = i
			try:
				left[x].append(dc[i][-1])
			except:
				left[x] = [dc[i][-1]]
	select2 = []
	for i in left:
		j = 0
		l = len(left[i])
		while j < l - 1:
			select2.append([left[i][j], left[i][j + 1]])
			j += 2
	(i, j) = (0, 0)
	(c1, c2) = (len(select), len(select2))
	while i < c1 and j < c2:
		ans.append(select[i] + select2[j])
		i += 1
		j += 1
	while i < c1 - 1:
		ans.append(select[i] + select[i + 1])
		i += 2
	print(len(ans))
	for (i, j, k, l) in ans:
		print(a1[k], a1[i])
		print(a1[l], a1[j])
main()


from os import path
from io import BytesIO, IOBase
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, Counter, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 998244353
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('0')
file = 1

def ceil(a, b):
	return (a + b - 1) // b

def solve():
	n = ii()
	m = {}
	for i in range(n):
		s = si()
		c = 0
		p = -1
		for j in s:
			if j in ['a', 'e', 'i', 'o', 'u']:
				p = j
				c += 1
		if c not in m:
			m[c] = []
		m[c].append(s)
	last = []
	first = []
	for i in m.keys():
		m1 = {'a': [], 'e': [], 'i': [], 'o': [], 'u': []}
		for s in m[i]:
			for j in s:
				if j in ['a', 'e', 'i', 'o', 'u']:
					p = j
			m1[p].append(s)
		rem = []
		for j in m1.values():
			x = j
			for k in range(0, len(x) - 1, 2):
				last.append([x[k], x[k + 1]])
			if len(x) & 1:
				rem.append(x[-1])
		for j in range(0, len(rem) - 1, 2):
			first.append([rem[j], rem[j + 1]])
	n = len(first)
	m = len(last)
	print(min(m, (n + m) // 2))
	for i in range(min(n, m)):
		print(first[i][0], end=' ')
		print(last[i][0])
		print(first[i][1], end=' ')
		print(last[i][1])
	for i in range(min(n, m), m - 1, 2):
		print(last[i][0], end=' ')
		print(last[i + 1][0])
		print(last[i][1], end=' ')
		print(last[i + 1][1])
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


n = int(input())
words = {}
for i in range(n):
	wrd = input()
	count = 0
	latest = None
	for letter in wrd:
		if letter == 'a' or letter == 'e' or letter == 'i' or (letter == 'o') or (letter == 'u'):
			count += 1
			latest = letter
	if count not in words:
		words[count] = {}
	if latest not in words[count]:
		words[count][latest] = []
	words[count][latest].append(wrd)
first_pairs = []
second_paird = []
for (length, letter_dct) in words.items():
	nosecond_curlength = []
	for words_array in letter_dct.values():
		cnt = len(words_array)
		for i in range(cnt // 2):
			second_paird.append([words_array.pop(), words_array.pop()])
		if cnt % 2 == 1:
			nosecond_curlength.append(words_array.pop())
	cnt = len(nosecond_curlength)
	for i in range(cnt // 2):
		first_pairs.append([nosecond_curlength.pop(), nosecond_curlength.pop()])
secondcnt = len(second_paird)
firstcnt = len(first_pairs)
if secondcnt < firstcnt:
	print(secondcnt)
else:
	print(firstcnt + (secondcnt - firstcnt) // 2)
while 1:
	if first_pairs:
		fpair = first_pairs.pop()
	elif second_paird:
		fpair = second_paird.pop()
	else:
		break
	if second_paird:
		spair = second_paird.pop()
	else:
		break
	print(fpair[0], spair[0])
	print(fpair[1], spair[1])


def solve(counts):
	ans = []
	for count in counts.keys():
		words = counts[count]
		for i in range(5):
			ending_words = words[i]
			while True:
				if len(ending_words) > 1:
					line1 = [ending_words.pop()]
					line2 = [ending_words.pop()]
					ans.append([line1, line2])
				else:
					break
	index = 0
	for count in counts.keys():
		words = counts[count]
		line = []
		for i in range(5):
			ending_words = words[i]
			if len(ending_words) > 0:
				if not line:
					line.append(ending_words.pop())
				else:
					line.append(ending_words.pop())
					if not ans:
						print(0)
						return
					if index < len(ans):
						ans[index][0].append(line[0])
						ans[index][1].append(line[1])
						ans[index][0].reverse()
						ans[index][1].reverse()
						index += 1
					line = []
	new_ans = []
	for i in range(index):
		new_ans.append(ans[i])
	while True:
		if index < len(ans):
			curr = ans[index]
			if index + 1 < len(ans):
				nexxt = ans[index + 1]
				temp = [[curr[0][0], nexxt[0][0]], [curr[1][0], nexxt[1][0]]]
				new_ans.append(temp)
		else:
			break
		index += 2
	print(len(new_ans))
	for i in new_ans:
		for j in range(2):
			print(i[j][0], i[j][1])

def getVowelCount(word):
	count = 0
	vowels = ['a', 'e', 'i', 'o', 'u']
	last = ''
	for i in word:
		if i in vowels:
			count += 1
			last = i
	return (count, last)

def main():
	index = {}
	index['a'] = 0
	index['e'] = 1
	index['i'] = 2
	index['o'] = 3
	index['u'] = 4
	n = int(input())
	counts = {}
	for i in range(n):
		word = input()
		(count, last) = getVowelCount(word)
		if count not in counts.keys():
			counts[count] = [[] for j in range(5)]
			counts[count][index[last]].append(word)
		else:
			counts[count][index[last]].append(word)
	solve(counts)
main()


import sys

def key(s):
	a = list(filter(lambda x: x in ('a', 'e', 'o', 'i', 'u'), s))
	return (len(a), a[-1])
n = int(input())
ss = map(lambda x: x.strip(), sys.stdin.readlines())
srt = sorted(ss, key=key)
pairs = []
tmp = []
i = 0
while i < n - 1:
	k1 = key(srt[i])
	k2 = key(srt[i + 1])
	if k1 == k2:
		pairs.append((srt[i], srt[i + 1]))
		i += 2
	else:
		tmp.append(srt[i])
		i += 1
while i < n:
	tmp.append(srt[i])
	i += 1
rest = []
i = 0
while i < len(tmp) - 1:
	k1 = key(tmp[i])
	k2 = key(tmp[i + 1])
	if k1[0] == k2[0]:
		rest.append((tmp[i], tmp[i + 1]))
		i += 2
	else:
		i += 1
if len(pairs) <= len(rest):
	result = list(zip(rest, pairs))
else:
	off = (len(pairs) - len(rest)) // 2
	result = list(zip(rest + pairs[len(pairs) - off:], pairs[:len(pairs) - off]))
print(len(result))
output = []
for (l, r) in result:
	output.append('%s %s' % (l[0], r[0]))
	output.append('%s %s' % (l[1], r[1]))
print('\n'.join(output))


import os
from io import BytesIO, StringIO
DEBUG = False
debug_print = print if DEBUG else lambda *x, **y: None

def input_as_list():
	return list(map(int, input().split()))

def array_of(f, *dim):
	return [array_of(f, *dim[1:]) for _ in range(dim[0])] if dim else f()

def main():
	from collections import defaultdict
	n = int(input())
	vowels = 'aeiou'

	def parse(s):
		count = 0
		last_vowel = ''
		for c in s:
			if c in vowels:
				count += 1
				last_vowel = c
		return (count, last_vowel)
	alls = []
	pool = defaultdict(dict)
	poolA = []
	poolB = []
	for _ in range(n):
		alls.append(input())
	for s in alls:
		(c, lv) = parse(s)
		if lv in pool[c]:
			s2 = pool[c].pop(lv)
			poolB.append((s, s2))
		else:
			pool[c][lv] = s
	for d in pool.values():
		d = [s for s in d.values()]
		while len(d) >= 2:
			poolA.append((d.pop(), d.pop()))
	debug_print(poolA, poolB, n)
	out = []
	while poolB:
		(s2, s4) = poolB.pop()
		if poolA:
			(s1, s3) = poolA.pop()
		elif poolB:
			(s1, s3) = poolB.pop()
		else:
			break
		out.append(s1 + ' ' + s2 + '\n' + s3 + ' ' + s4)
	print(len(out))
	print('\n'.join(out))
main()


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = 1
	for _ in range(tc):
		n = ri()
		z = {}
		words = []
		p = []
		for i in range(n):
			lv = '.'
			nv = 0
			k = rs()
			words.append(k)
			for j in k:
				if j in ['a', 'e', 'i', 'o', 'u']:
					lv = j
					nv += 1
			p.append(nv)
			if (nv, lv) in z:
				z[nv, lv].append(i)
			else:
				z[nv, lv] = [i]
		nvd = Counter(p)
		thiscanbeasecond = []
		for i in nvd:
			for j in ['a', 'e', 'i', 'o', 'u']:
				if (i, j) in z:
					while len(z[i, j]) >= 2:
						s12 = z[i, j].pop()
						s22 = z[i, j].pop()
						thiscanbeasecond.append([s12, s22])
		c = 0
		firstmein = {}
		for i in nvd:
			for j in ['a', 'e', 'i', 'o', 'u']:
				if (i, j) in z:
					for k in z[i, j]:
						c += 1
						if i not in firstmein:
							firstmein[i] = [k]
						else:
							firstmein[i].append(k)
		ans = []
		for i in nvd:
			if i in firstmein:
				while len(firstmein[i]) >= 2 and len(thiscanbeasecond) >= 1:
					s11 = firstmein[i].pop()
					s21 = firstmein[i].pop()
					(s12, s22) = thiscanbeasecond.pop()
					ans.append([words[s11], words[s12]])
					ans.append([words[s21], words[s22]])
		while len(thiscanbeasecond) >= 2:
			(s11, s21) = thiscanbeasecond.pop()
			(s12, s22) = thiscanbeasecond.pop()
			ans.append([words[s11], words[s12]])
			ans.append([words[s21], words[s22]])
		print(len(ans) // 2)
		for i in ans:
			print(*i)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


import sys
input = sys.stdin.readline
n = int(input())
W = [input().strip() for i in range(n)]
V = {'a', 'i', 'u', 'e', 'o'}
K = []
for (i, w) in enumerate(W):
	count = 0
	VKEY = ''
	for word in w:
		if word in V:
			count += 1
			VKEY = word
	K.append([count, VKEY, i])
K.sort()
from collections import deque
K2 = deque(K)
Q = deque()
Q2 = deque()
while K2:
	if len(K2) >= 2 and K2[0][0] == K2[1][0] and (K2[0][1] == K2[1][1]):
		x = K2.popleft()
		y = K2.popleft()
		Q2.append(x)
		Q2.append(y)
	else:
		x = K2.popleft()
		Q.append(x)
Q1 = deque()
while Q:
	if len(Q) >= 2 and Q[0][0] == Q[1][0]:
		x = Q.popleft()
		y = Q.popleft()
		Q1.append(x)
		Q1.append(y)
	else:
		x = Q.popleft()
ANS = []
while Q1 and Q2:
	x = Q1.popleft()
	y = Q2.popleft()
	z = Q1.popleft()
	w = Q2.popleft()
	ANS.append([x[2], y[2], z[2], w[2]])
while len(Q2) >= 4:
	x = Q2.popleft()
	y = Q2.popleft()
	z = Q2.popleft()
	w = Q2.popleft()
	ANS.append([x[2], z[2], y[2], w[2]])
print(len(ANS))
for (x, y, z, w) in ANS:
	print(W[x], W[y])
	print(W[z], W[w])


import math
import sys
n = int(input())
dicn = [{} for i in range(10 ** 6)]
maxv = set()
v = {'a', 'e', 'i', 'o', 'u'}
for i in range(n):
	t = input()
	c = 0
	lv = ''
	for l in t:
		if l in v:
			c += 1
			lv = l
	if lv in dicn[c - 1]:
		dicn[c - 1][lv].append(t)
	else:
		dicn[c - 1][lv] = [t]
	maxv.add(c)
maxv = sorted(list(maxv))
first = [[] for i in range(maxv[-1])]
second = []
for i in maxv:
	for j in dicn[i - 1]:
		if len(dicn[i - 1][j]) % 2 == 1:
			first[i - 1].append(dicn[i - 1][j].pop())
		if len(dicn[i - 1][j]) > 0:
			second += dicn[i - 1][j]
t = []
c = 0
for f in first:
	while len(f) >= 2 and len(second) >= 2:
		c += 1
		t.append(' '.join([f.pop(), second.pop()]))
		t.append(' '.join([f.pop(), second.pop()]))
while len(second) >= 4:
	c += 1
	q = []
	w = []
	q.append(second.pop())
	w.append(second.pop())
	q.append(second.pop())
	w.append(second.pop())
	t.append(' '.join(q))
	t.append(' '.join(w))
print(len(t) // 2)
for i in t:
	print(i)