class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: E = None
        self.p: D = None
        self.t: C = None
        self.txt = txt

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

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

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

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

f = A("f")
i = B("i")
m = C("m")
b = D("b")
g = E("g")

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

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

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

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

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

f = A("f")
i = B("i")
m = C("m")
b = D("b")
g = E("g")

f.y = g
f.u = g
f.p = b
f.t = m
i.y = b
i.z = b
i.x = g
m.t = i
m.o = i
b.o = f
b.v = f
b.u = f
b.q = i
b.w = i
g.o = b
g.u = f
g.q = f
assert g.u.y.u.t.o.txt == "i"