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

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

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

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

d = A("d")
k = B("k")
j = C("j")
i = D("i")

d.o = j
d.y = k
k.t = i
k.y = i
j.t = d
j.z = d
j.q = d
i.v = k
i.s = j
i.w = d
assert d.y.y.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.y: B = None
        self.txt = txt

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

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

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

d = A("d")
k = B("k")
j = C("j")
i = D("i")

d.o = j
d.y = k
k.t = i
k.y = i
j.t = d
j.z = d
j.q = d
i.v = k
i.s = j
i.w = d
assert d.y.y.s.t.txt == "d"