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

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

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

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

n = A("n")
b = B("b")
l = C("l")
c = D("c")
h = D("h")
d = D("d")
e = A("e")
j = C("j")

n.y = e
n.q = b
n.o = b
n.u = b
b.v = n
l.r = n
l.s = d
c.p = b
c.z = b
c.r = h
h.p = b
h.z = b
h.r = d
d.p = b
d.z = b
d.r = h
e.y = n
e.q = b
e.o = b
e.u = b
j.r = n
j.s = h
assert l.s.r.r.r.r.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.q: B = None
        self.o: B = None
        self.u: B = None
        self.txt = txt

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

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

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

n = A("n")
b = B("b")
l = C("l")
c = D("c")
h = D("h")
d = D("d")
e = A("e")
j = C("j")

n.y = e
n.q = b
n.o = b
n.u = b
b.v = n
l.r = n
l.s = d
c.p = b
c.z = b
c.r = h
h.p = b
h.z = b
h.r = d
d.p = b
d.z = b
d.r = h
e.y = n
e.q = b
e.o = b
e.u = b
j.r = n
j.s = h
assert l.s.r.r.r.r.p.v.txt == "n"