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

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

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

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

b = A("b")
l = B("l")
j = C("j")
m = D("m")
c = D("c")
h = D("h")
a = C("a")

b.p = h
l.o = h
l.u = j
j.r = b
j.q = h
j.v = h
j.u = a
m.y = c
m.u = b
m.t = l
m.p = j
c.y = m
c.u = b
c.t = l
c.p = j
h.y = m
h.u = b
h.t = l
h.p = j
a.r = b
a.q = h
a.u = j
a.v = c
assert l.u.u.q.p.r.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

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

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

b = A("b")
l = B("l")
j = C("j")
m = D("m")
c = D("c")
h = D("h")
a = C("a")

b.p = h
l.o = h
l.u = j
j.r = b
j.q = h
j.v = h
j.u = a
m.y = c
m.u = b
m.t = l
m.p = j
c.y = m
c.u = b
c.t = l
c.p = j
h.y = m
h.u = b
h.t = l
h.p = j
a.r = b
a.q = h
a.u = j
a.v = c
assert l.u.u.q.p.r.p.y.txt == "m"