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

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

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

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

n = A("n")
m = B("m")
k = C("k")
h = D("h")
b = C("b")
e = D("e")
l = C("l")

n.s = k
n.u = k
n.z = m
n.r = h
m.r = l
k.v = n
k.p = m
k.q = m
k.y = m
h.u = m
h.r = m
b.v = n
b.p = m
b.q = m
b.y = m
e.u = m
e.r = m
l.v = n
l.p = m
l.q = m
l.y = m
assert n.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: B = None
        self.u: C = None
        self.r: D = None
        self.txt = txt

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

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

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

n = A("n")
m = B("m")
k = C("k")
h = D("h")
b = C("b")
e = D("e")
l = C("l")

n.s = k
n.u = k
n.z = m
n.r = h
m.r = l
k.v = n
k.p = m
k.q = m
k.y = m
h.u = m
h.r = m
b.v = n
b.p = m
b.q = m
b.y = m
e.u = m
e.r = m
l.v = n
l.p = m
l.q = m
l.y = m
assert n.r.r.r.txt == "l"