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

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

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

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

n = A("n")
g = B("g")
k = C("k")
m = D("m")
c = A("c")
i = A("i")
e = A("e")
l = B("l")
h = B("h")

n.o = l
n.u = i
n.t = m
g.r = l
g.u = m
k.p = l
k.z = n
k.r = m
k.t = g
m.p = k
m.w = k
m.r = k
c.o = h
c.u = i
c.t = m
i.o = l
i.u = e
i.t = m
e.o = h
e.u = i
e.t = m
l.r = h
l.u = m
h.r = g
h.u = m
assert k.t.u.w.p.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: A = None
        self.t: D = None
        self.txt = txt

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

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

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

n = A("n")
g = B("g")
k = C("k")
m = D("m")
c = A("c")
i = A("i")
e = A("e")
l = B("l")
h = B("h")

n.o = l
n.u = i
n.t = m
g.r = l
g.u = m
k.p = l
k.z = n
k.r = m
k.t = g
m.p = k
m.w = k
m.r = k
c.o = h
c.u = i
c.t = m
i.o = l
i.u = e
i.t = m
e.o = h
e.u = i
e.t = m
l.r = h
l.u = m
h.r = g
h.u = m
assert k.t.u.w.p.r.u.txt == "m"