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

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: B = None
        self.z: B = None
        self.o: B = None
        self.x: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: B = None
        self.s: A = None
        self.txt = txt

f = A("f")
m = B("m")
l = C("l")
e = D("e")
n = E("n")
h = B("h")

f.t = l
f.s = h
f.o = m
m.t = e
l.y = f
l.z = h
l.w = e
l.o = e
l.p = n
e.s = l
e.x = l
e.q = h
e.o = h
e.z = m
n.y = f
n.s = f
n.r = m
h.t = e
assert h.t.z.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.s: B = None
        self.o: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: B = None
        self.z: B = None
        self.o: B = None
        self.x: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: B = None
        self.s: A = None
        self.txt = txt

f = A("f")
m = B("m")
l = C("l")
e = D("e")
n = E("n")
h = B("h")

f.t = l
f.s = h
f.o = m
m.t = e
l.y = f
l.z = h
l.w = e
l.o = e
l.p = n
e.s = l
e.x = l
e.q = h
e.o = h
e.z = m
n.y = f
n.s = f
n.r = m
h.t = e
assert h.t.z.t.z.txt == "m"