class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: A = None
        self.txt = txt

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

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

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

n = A("n")
m = B("m")
l = C("l")
k = D("k")
f = B("f")
h = C("h")
c = D("c")
e = A("e")
a = A("a")

n.w = a
n.r = e
m.p = h
l.z = h
l.s = k
l.o = n
l.v = n
k.y = c
k.u = c
k.t = h
k.r = m
f.p = l
h.z = l
h.s = c
h.o = n
h.v = e
c.y = k
c.u = k
c.t = h
c.r = f
e.w = n
e.r = a
a.w = n
a.r = e
assert m.p.s.y.u.r.p.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: A = None
        self.txt = txt

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

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

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

n = A("n")
m = B("m")
l = C("l")
k = D("k")
f = B("f")
h = C("h")
c = D("c")
e = A("e")
a = A("a")

n.w = a
n.r = e
m.p = h
l.z = h
l.s = k
l.o = n
l.v = n
k.y = c
k.u = c
k.t = h
k.r = m
f.p = l
h.z = l
h.s = c
h.o = n
h.v = e
c.y = k
c.u = k
c.t = h
c.r = f
e.w = n
e.r = a
a.w = n
a.r = e
assert m.p.s.y.u.r.p.s.r.txt == "m"