class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: D = None
        self.txt = txt

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

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

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

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

n.r = k
n.o = f
d.s = n
d.y = h
e.u = k
a.u = m
a.t = e
a.z = d
k.u = e
m.r = e
m.o = b
f.u = m
f.t = k
f.z = d
h.s = n
h.y = i
i.s = m
i.y = h
b.u = m
b.t = k
b.z = i
assert n.o.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: D = None
        self.txt = txt

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

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

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

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

n.r = k
n.o = f
d.s = n
d.y = h
e.u = k
a.u = m
a.t = e
a.z = d
k.u = e
m.r = e
m.o = b
f.u = m
f.t = k
f.z = d
h.s = n
h.y = i
i.s = m
i.y = h
b.u = m
b.t = k
b.z = i
assert n.o.z.s.txt == "n"