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

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

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

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

f = A("f")
m = B("m")
k = C("k")
j = D("j")

f.s = j
f.o = j
f.t = k
f.x = m
m.v = f
m.x = k
m.s = j
k.y = m
k.o = f
j.z = f
j.p = k
assert k.y.s.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.t: C = None
        self.x: B = None
        self.o: D = None
        self.txt = txt

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

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

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

f = A("f")
m = B("m")
k = C("k")
j = D("j")

f.s = j
f.o = j
f.t = k
f.x = m
m.v = f
m.x = k
m.s = j
k.y = m
k.o = f
j.z = f
j.p = k
assert k.y.s.z.s.txt == "j"