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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.u: D = None
        self.txt = txt

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

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

h = A("h")
n = B("n")
d = C("d")
k = D("k")
i = B("i")
a = A("a")

h.z = a
h.u = i
h.x = d
h.w = d
n.v = k
n.u = k
d.t = h
k.v = d
i.v = k
i.u = k
a.z = h
a.u = n
a.x = d
a.w = d
assert h.z.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.u: B = None
        self.x: C = None
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.u: D = None
        self.txt = txt

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

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

h = A("h")
n = B("n")
d = C("d")
k = D("k")
i = B("i")
a = A("a")

h.z = a
h.u = i
h.x = d
h.w = d
n.v = k
n.u = k
d.t = h
k.v = d
i.v = k
i.u = k
a.z = h
a.u = n
a.x = d
a.w = d
assert h.z.u.v.txt == "k"