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

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

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

j = A("j")
m = B("m")
e = C("e")
b = D("b")
l = E("l")
a = D("a")
f = A("f")
c = E("c")
n = E("n")

j.q = m
j.u = m
j.y = e
j.w = e
j.r = f
m.u = j
m.o = j
e.y = f
b.u = a
l.u = e
l.r = e
l.q = c
a.u = b
f.q = m
f.u = m
f.y = e
f.w = e
f.r = j
c.u = e
c.r = e
c.q = n
n.u = e
n.r = e
n.q = c
assert a.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: C = None
        self.u: B = None
        self.w: C = None
        self.r: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

j = A("j")
m = B("m")
e = C("e")
b = D("b")
l = E("l")
a = D("a")
f = A("f")
c = E("c")
n = E("n")

j.q = m
j.u = m
j.y = e
j.w = e
j.r = f
m.u = j
m.o = j
e.y = f
b.u = a
l.u = e
l.r = e
l.q = c
a.u = b
f.q = m
f.u = m
f.y = e
f.w = e
f.r = j
c.u = e
c.r = e
c.q = n
n.u = e
n.r = e
n.q = c
assert a.u.u.u.u.txt == "a"