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

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

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: C = None
        self.p: B = None
        self.txt = txt

f = A("f")
a = B("a")
k = C("k")
b = D("b")
j = A("j")

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

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

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: C = None
        self.p: B = None
        self.txt = txt

f = A("f")
a = B("a")
k = C("k")
b = D("b")
j = A("j")

f.z = a
f.s = b
f.p = b
f.t = k
a.p = k
a.s = b
a.t = j
k.t = a
k.y = j
b.x = a
b.p = a
b.r = k
j.z = a
j.s = b
j.p = b
j.t = k
assert f.s.r.t.txt == "a"