class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: B = None
        self.txt = txt

e = A("e")
n = B("n")
j = C("j")
l = A("l")
a = B("a")
i = B("i")
d = A("d")
g = A("g")
c = C("c")

e.x = j
e.u = g
n.o = c
j.r = c
j.u = n
l.x = c
l.u = g
a.o = j
i.o = j
d.x = j
d.u = l
g.x = c
g.u = e
c.r = j
c.u = a
assert l.x.u.o.r.r.r.r.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: B = None
        self.txt = txt

e = A("e")
n = B("n")
j = C("j")
l = A("l")
a = B("a")
i = B("i")
d = A("d")
g = A("g")
c = C("c")

e.x = j
e.u = g
n.o = c
j.r = c
j.u = n
l.x = c
l.u = g
a.o = j
i.o = j
d.x = j
d.u = l
g.x = c
g.u = e
c.r = j
c.u = a
assert l.x.u.o.r.r.r.r.r.u.txt == "a"