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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.u: E = None
        self.z: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.u: A = None
        self.z: B = None
        self.y: C = None
        self.txt = txt

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

l = A("l")
g = B("g")
m = C("m")
c = D("c")
f = E("f")
h = D("h")
d = D("d")
b = D("b")
a = B("a")

l.t = m
g.q = l
g.u = f
g.z = b
m.q = h
c.s = f
c.u = l
c.z = g
c.y = m
f.s = m
f.r = b
h.s = f
h.u = l
h.z = g
h.y = m
d.s = f
d.u = l
d.z = a
d.y = m
b.s = f
b.u = l
b.z = g
b.y = m
a.q = l
a.u = f
a.z = c
assert c.u.t.q.s.s.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.u: E = None
        self.z: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.u: A = None
        self.z: B = None
        self.y: C = None
        self.txt = txt

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

l = A("l")
g = B("g")
m = C("m")
c = D("c")
f = E("f")
h = D("h")
d = D("d")
b = D("b")
a = B("a")

l.t = m
g.q = l
g.u = f
g.z = b
m.q = h
c.s = f
c.u = l
c.z = g
c.y = m
f.s = m
f.r = b
h.s = f
h.u = l
h.z = g
h.y = m
d.s = f
d.u = l
d.z = a
d.y = m
b.s = f
b.u = l
b.z = g
b.y = m
a.q = l
a.u = f
a.z = c
assert c.u.t.q.s.s.q.s.txt == "f"