For a given value N, denoting the number of Characters starting from the A, print reverse character bridge pattern.
 
Example 1:
Input:
N = 5
Output:
ABCDEDCBA
ABCD DCBA
ABC   CBA
AB     BA
A       A
Example 2:
Input:
N = 4
Output:
ABCDCBA
ABC CBA
AB   BA
A     A
 
Your Task:
You don't need to read input or print anything. Your task is to complete the function revCharBridge() which takes an Integer N as input and returns a vector of strings where each line represents lines of the pattern. For example, if N = 3, the vector v = {"ABCBA", "AB BA", "A   A"}.
 
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(N)
 
Constraints:
2 <= N <= 26

Difficulty: EASY
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(N)

Starter code:
#User function Template for python3



class Solution:

    def revCharBridge(self, N):

        # code here 

Solutions:
class Solution:

	def revCharBridge(self, N):
		l = []
		co = 0
		c = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		for i in range(N, 0, -1):
			start = c[:i]
			if i == N - 1:
				co = 1
			else:
				co += 2
			center = ' ' * co
			end = start[::-1]
			if i == N:
				l.append(start + end[1:])
			else:
				l.append(start + center + end)
		return l


class Solution:

	def revCharBridge(self, N):
		y = []
		for i in range(0, N):
			d = 65
			s = ''
			for j in range(0, N - i):
				s = s + chr(d)
				d = d + 1
			s = s + i * ' '
			r = s[::-1]
			s = s + r[1:]
			y.append(s)
		return y


class Solution:

	def revCharBridge(self, n):
		l = []
		c = -1
		for i in range(n, 0, -1):
			s = ''
			k = i
			for j in range(1, i + 1):
				s = s + chr(j + 64)
			for sp in range(1, c + 1):
				s = s + ' '
			if i == n:
				k = i - 1
			for j in range(k, 0, -1):
				s = s + chr(j + 64)
			c += 2
			l.append(s)
		return l


class Solution:

	def revCharBridge(self, N):
		l = []
		for i in range(1, N + 1):
			c = 0
			d = -1
			s2 = ''
			for j in range(1, 2 * N):
				if j == N - i + 1 and j == N + i - 1:
					s2 += chr(65 + c)
					c += 1
				elif j >= N + i - 1:
					s2 += chr(65 + d)
					d -= 1
				elif j <= N - i + 1:
					d += 1
					s2 += chr(65 + c)
					c += 1
				else:
					s2 += ' '
			l.append(s2)
		return l


class Solution:

	def revCharBridge(self, N):
		c = []
		for i in range(1, N + 1):
			s = ''
			if i == 1:
				for j in range(1, N - i + 1 + 1):
					s += chr(64 + j)
				for k in range(N - 1, 0, -1):
					s += chr(64 + k)
			else:
				for j in range(1, N - i + 2):
					s += chr(64 + j)
				for l in range(1, 2 * (i - 1)):
					s += ' '
				for k in range(N - i + 1, 0, -1):
					s += chr(64 + k)
			c.append(s)
		return c


class Solution:

	def revCharBridge(self, N):
		l = []
		s = ''
		for i in range(65, 65 + N):
			s += chr(i)
		s1 = N
		s2 = 1
		l.append(s + s[0:N - 1][::-1])
		z = ''
		for i in range(N - 1):
			z = ''
			z += s[0:s1 - 1]
			for i in range(s2):
				z += ' '
			z += s[0:s1 - 1][::-1]
			l.append(z)
			s1 -= 1
			s2 += 2
		return l


class Solution:

	def revCharBridge(self, N):
		alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		res = []
		for i in range(N, 0, -1):
			a = alp[:i]
			if i == N:
				res.append(a + a[::-1][1:])
			else:
				res.append(a + ' ' * (N * 2 - 1 - i * 2) + a[::-1])
		return res


class Solution:

	def revCharBridge(self, N):
		p = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		req = p[0:N]
		l = []
		l.append(req + p[N - 2::-1])
		for i in range(1, N):
			l.append(p[0:N - i] + (1 + (i - 1) * 2) * ' ' + p[N - i - 1::-1])
		return l


class Solution:

	def revCharBridge(self, N):
		Text = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		req = Text[0:N]
		v = []
		v.append(req + Text[N - 2::-1])
		for i in range(1, N):
			v.append(req[0:N - i] + (1 + (i - 1) * 2) * ' ' + Text[N - i - 1::-1])
		return v


class Solution:

	def revCharBridge(self, N):
		t = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		r = t[0:N]
		v = []
		v.append(r + t[N - 2::-1])
		for i in range(1, N):
			v.append(r[0:N - i] + (1 + (i - 1) * 2) * ' ' + t[N - i - 1::-1])
		return v


class Solution:

	def revCharBridge(self, N):
		x = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		ans = []
		for i in range(N):
			a = x[:N - i]
			b = a[::-1]
			c = ''
			if i == 0:
				c += a
				c += b[1:]
			else:
				c += a
				c += ' ' * (2 * i - 1)
				c += b
			ans.append(c)
		return ans


class Solution:

	def revCharBridge(self, N):
		l = []
		space = ' '
		for i in range(N):
			a = ord('A') - 1
			k = ''
			for j in range(N - i):
				a = a + 1
				k += chr(a)
			if i != 0:
				k += space
				space += '  '
			if i == 0:
				a = a - 1
			for j in range(N - i):
				if i == 0 and j == N - i - 1:
					continue
				k += chr(a)
				a = a - 1
			l.append(k)
		return l


class Solution:

	def revCharBridge(self, N):
		alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		str_list = []
		empty_str = ''
		for i in range(N, 0, -1):
			if i == N:
				new_str = alpha[0:i] + empty_str + alpha[i - 2::-1]
				empty_str += ' '
			else:
				new_str = alpha[0:i] + empty_str + alpha[i - 1::-1]
				empty_str += '  '
			str_list.append(new_str)
		return str_list


class Solution:

	def revCharBridge(self, N):
		Text = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		req = Text[0:N]
		v = []
		v.append(req + Text[N - 2::-1])
		for i in range(1, N):
			v.append(req[0:N - i] + (1 + (i - 1) * 2) * ' ' + Text[N - i - 1::-1])
		return v
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		ptr = ob.revCharBridge(N)
		for i in ptr:
			print(i)


class Solution:

	def revCharBridge(self, N):
		h = 65
		e = ''
		for i in range(N):
			e += chr(h)
			h += 1
		f = e[:N - 1]
		e = e + f[::-1]
		l = [e]
		for i in range(N - 1, 0, -1):
			e = ''
			h = 65
			for j in range(i):
				e += chr(h)
				h += 1
			f = e[::-1]
			e += (2 * (N - i) - 1) * ' '
			e += f
			l.append(e)
		return l
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		ptr = ob.revCharBridge(N)
		for i in ptr:
			print(i)


class Solution:

	def revCharBridge(self, N):
		t = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		ans = []
		req = t[0:N]
		ans.append(req + t[N - 2::-1])
		for i in range(1, N):
			ans.append(req[0:N - i] + (2 * (i - 1) + 1) * ' ' + t[N - 1 - i::-1])
		return ans


class Solution:

	def revCharBridge(self, N):
		l = []
		for i in range(N):
			ch = 65
			temp = ''
			for j in range(i, N):
				temp = temp + chr(ch)
				ch += 1
			for k in range(0, i):
				temp = temp + ' '
			temp = temp + temp[-2::-1]
			l.append(temp)
		return l


class Solution:

	def revCharBridge(self, N):
		result = []
		for i in range(0, N):
			word = ''
			spaces = ''
			reverse = ''
			for j in range(N - i):
				word += chr(65 + j)
			if i:
				spaces += ' ' * (2 * i - 1)
				reverse = word[::-1]
			else:
				reverse = word[:-1][::-1]
			word += spaces
			word += reverse
			result.append(word)
		return result


class Solution:

	def revCharBridge(self, N):
		a = []
		for i in range(N):
			t = ''
			x = 'A'
			for j in range(N - i):
				t += x
				x = chr(ord(x) + 1)
			for j in range(2 * i - 1):
				t += ' '
			if i == 0:
				x = chr(ord(x) - 2)
				for j in range(N - i - 1):
					t += x
					x = chr(ord(x) - 1)
			else:
				x = chr(ord(x) - 1)
				for j in range(N - i):
					t += x
					x = chr(ord(x) - 1)
			a.append(t)
		return a


class Solution:

	def revCharBridge(self, N):
		ans = []
		for i in range(N):
			cha = ord('A')
			a = ''
			for j in range(1, N - i + 1):
				a += chr(cha)
				cha += 1
			for j in range(i):
				a += ' '
			if i == 0:
				cha -= 2
			else:
				cha -= 1
			for j in range(1, N):
				if j < i:
					a += ' '
				else:
					a += chr(cha)
					cha -= 1
			ans.append(a)
		return ans