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

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

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

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

k = A("k")
c = B("c")
j = C("j")
m = D("m")
d = B("d")
b = C("b")

k.y = d
c.z = k
j.r = b
j.o = b
j.z = k
j.t = c
m.s = d
m.q = d
m.x = d
m.v = b
d.z = k
b.r = j
b.o = j
b.z = k
b.t = c
assert d.z.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

k = A("k")
c = B("c")
j = C("j")
m = D("m")
d = B("d")
b = C("b")

k.y = d
c.z = k
j.r = b
j.o = b
j.z = k
j.t = c
m.s = d
m.q = d
m.x = d
m.v = b
d.z = k
b.r = j
b.o = j
b.z = k
b.t = c
assert d.z.y.z.txt == "k"