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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

c = A("c")
n = B("n")
i = C("i")
d = D("d")

c.t = n
c.z = d
c.o = d
n.w = c
i.s = c
d.q = n
assert i.s.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: D = None
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

c = A("c")
n = B("n")
i = C("i")
d = D("d")

c.t = n
c.z = d
c.o = d
n.w = c
i.s = c
d.q = n
assert i.s.o.q.txt == "n"