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

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

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

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

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

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

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

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

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

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

k.z = a
k.v = n
k.r = d
n.o = a
n.z = a
n.p = k
n.y = k
h.y = n
h.v = n
h.t = d
h.x = i
a.t = h
a.v = i
d.z = i
d.v = n
d.r = k
i.t = h
i.v = a
assert d.z.t.x.v.t.txt == "h"