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

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

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

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

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

f = A("f")
m = B("m")
e = C("e")
j = D("j")
i = E("i")

f.t = m
f.w = j
f.q = j
f.v = i
m.y = e
m.z = f
e.v = m
e.t = j
j.w = f
j.o = e
i.t = e
i.q = j
assert i.t.t.o.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: D = None
        self.q: D = None
        self.v: E = None
        self.txt = txt

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

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

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

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

f = A("f")
m = B("m")
e = C("e")
j = D("j")
i = E("i")

f.t = m
f.w = j
f.q = j
f.v = i
m.y = e
m.z = f
e.v = m
e.t = j
j.w = f
j.o = e
i.t = e
i.q = j
assert i.t.t.o.v.y.txt == "e"