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

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

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

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

k = A("k")
n = B("n")
a = C("a")
h = D("h")
e = C("e")
i = A("i")
c = B("c")
b = D("b")
f = B("f")

k.y = f
k.u = n
k.r = i
n.w = h
a.z = k
h.t = n
h.z = b
h.o = a
e.z = k
i.y = c
i.u = f
i.r = k
c.w = h
b.t = c
b.z = h
b.o = e
f.w = h
assert n.w.o.z.y.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: B = None
        self.r: A = None
        self.txt = txt

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

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

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

k = A("k")
n = B("n")
a = C("a")
h = D("h")
e = C("e")
i = A("i")
c = B("c")
b = D("b")
f = B("f")

k.y = f
k.u = n
k.r = i
n.w = h
a.z = k
h.t = n
h.z = b
h.o = a
e.z = k
i.y = c
i.u = f
i.r = k
c.w = h
b.t = c
b.z = h
b.o = e
f.w = h
assert n.w.o.z.y.w.t.txt == "n"