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

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

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

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

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

n.w = f
l.v = i
i.v = f
i.r = k
i.q = c
i.w = m
k.x = l
k.u = l
k.y = m
h.x = l
h.u = f
h.y = m
c.v = i
f.v = m
m.v = f
m.r = h
m.q = l
m.w = i
assert m.r.y.w.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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

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

n.w = f
l.v = i
i.v = f
i.r = k
i.q = c
i.w = m
k.x = l
k.u = l
k.y = m
h.x = l
h.u = f
h.y = m
c.v = i
f.v = m
m.v = f
m.r = h
m.q = l
m.w = i
assert m.r.y.w.r.x.txt == "l"