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

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

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

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

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

a = A("a")
c = B("c")
d = C("d")
g = D("g")
k = E("k")
e = C("e")

a.t = d
c.z = k
c.v = g
d.o = g
d.v = k
g.y = d
g.q = k
k.z = g
k.w = a
k.q = a
e.o = g
e.v = k
assert a.t.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

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

a = A("a")
c = B("c")
d = C("d")
g = D("g")
k = E("k")
e = C("e")

a.t = d
c.z = k
c.v = g
d.o = g
d.v = k
g.y = d
g.q = k
k.z = g
k.w = a
k.q = a
e.o = g
e.v = k
assert a.t.o.y.txt == "d"