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

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: E = None
        self.x: D = None
        self.o: D = None
        self.w: D = None
        self.txt = txt

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

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

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

f.z = m
f.y = l
f.t = g
f.q = e
m.q = l
l.q = f
l.t = e
l.x = g
l.o = g
l.w = g
g.u = m
g.z = l
g.x = l
e.y = f
assert e.y.y.t.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: C = None
        self.t: D = None
        self.q: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: E = None
        self.x: D = None
        self.o: D = None
        self.w: D = None
        self.txt = txt

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

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

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

f.z = m
f.y = l
f.t = g
f.q = e
m.q = l
l.q = f
l.t = e
l.x = g
l.o = g
l.w = g
g.u = m
g.z = l
g.x = l
e.y = f
assert e.y.y.t.y.t.txt == "g"