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

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

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

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

j = A("j")
n = B("n")
f = C("f")
b = D("b")
h = D("h")
d = B("d")
m = B("m")
i = B("i")
l = A("l")

j.u = b
j.q = b
j.w = h
j.v = f
n.u = j
n.q = l
f.x = h
f.p = b
b.x = h
b.y = i
h.x = b
h.y = n
d.u = l
d.q = l
m.u = l
m.q = l
i.u = j
i.q = l
l.u = b
l.q = b
l.w = b
l.v = f
assert m.q.v.p.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: D = None
        self.w: D = None
        self.v: C = None
        self.txt = txt

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

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

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

j = A("j")
n = B("n")
f = C("f")
b = D("b")
h = D("h")
d = B("d")
m = B("m")
i = B("i")
l = A("l")

j.u = b
j.q = b
j.w = h
j.v = f
n.u = j
n.q = l
f.x = h
f.p = b
b.x = h
b.y = i
h.x = b
h.y = n
d.u = l
d.q = l
m.u = l
m.q = l
i.u = j
i.q = l
l.u = b
l.q = b
l.w = b
l.v = f
assert m.q.v.p.x.x.x.x.x.txt == "h"