public static int[] row = { 2, 1, -1, -2, -2, -1, 1, 2, 2 };
public static int[] col = { 1, 2, 2, 1, -1, -2, -2, -1, 1};
public static string[,] characters = { {"A", "B", "C", "D", "E"}, {"", "G", "H", "I", "J"}, {"K", "L", "M", "N", "O"}, { "P", "Q", "R", "S", "T"}, { "U", "V", "", "", "Y"}};
public static string[] vowels = {"A","E", "I", "O", "U", "Y"};
public static void Main()
string[] visited = new string[8];
string startingPoint = Console.ReadLine();
for(int x = 0; x < 5; ++x)
for(int y = 0; y < 5; ++y)
if(characters[x,y].Equals(startingPoint.Trim().ToUpper()))
Console.WriteLine("Invalid Starting Point");
KnightTour(visited, startingX, startingY, pos);
private static void KnightTour(string[] visited, int x, int y, int pos)
visited[pos] = characters[x, y];
for(int k = 0; k < 8; k++)
if(isValid(newX, newY, visited))
KnightTour(visited, newX, newY, pos + 1);
private static bool isValid(int x, int y, string[] track)
if((x < 0 || y < 0 || x > N || y > N))
if(track.Intersect(vowels).Count() > 2)
if(characters[x, y] == "")
private static void print(string[] visited)
foreach(string i in visited)
Console.Write("{0} ", i);