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

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

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

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

e = A("e")
i = B("i")
c = C("c")
d = D("d")
k = D("k")

e.t = c
e.q = i
e.z = d
e.x = d
i.z = c
i.x = c
i.y = k
i.s = e
c.o = i
d.s = k
d.y = e
k.s = d
k.y = e
assert d.y.q.s.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: B = None
        self.z: D = None
        self.x: D = None
        self.txt = txt

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

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

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

e = A("e")
i = B("i")
c = C("c")
d = D("d")
k = D("k")

e.t = c
e.q = i
e.z = d
e.x = d
i.z = c
i.x = c
i.y = k
i.s = e
c.o = i
d.s = k
d.y = e
k.s = d
k.y = e
assert d.y.q.s.t.o.txt == "i"