using System.Collections.Generic;
public static void Main()
Console.WriteLine(CheckSectionsIntersect(new []{"U","L","D","D","R","U"},6));
Console.WriteLine(CheckSectionsIntersect(new []{"D","L","U","L"},4));
static Dictionary<string,(int X,int Y)> transforms = new Dictionary<string, (int X, int Y)>{
static bool CheckSectionsIntersect(string[] sectionDirection, int numberOfSections)
(int X, int Y) pos = (0,0);
for(var i = 0;i<numberOfSections;i++)
if(!transforms.TryGetValue(sectionDirection[i], out var transform))
throw new ArgumentException("sectionDirections");
if(pos.X == 0 && pos.Y == 0)