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

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

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

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

a = A("a")
c = B("c")
h = C("h")
n = D("n")

a.s = c
a.z = n
c.r = n
c.y = n
h.s = c
h.p = n
h.x = n
n.y = h
n.v = a
n.t = a
n.x = a
assert h.s.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: D = None
        self.txt = txt

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

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

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

a = A("a")
c = B("c")
h = C("h")
n = D("n")

a.s = c
a.z = n
c.r = n
c.y = n
h.s = c
h.p = n
h.x = n
n.y = h
n.v = a
n.t = a
n.x = a
assert h.s.r.v.txt == "a"