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

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

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

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

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

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

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

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

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

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

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