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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

j.q = c
j.p = c
j.y = b
j.r = b
b.r = m
b.v = m
b.z = k
m.q = n
m.u = h
m.w = b
m.r = b
m.z = c
c.r = i
c.t = m
c.p = d
n.t = j
h.q = d
h.u = m
h.w = b
h.r = b
h.z = c
d.t = j
i.q = c
i.p = c
i.y = b
i.r = b
l.q = c
l.p = c
l.y = b
l.r = b
k.t = i
assert b.z.t.q.p.t.r.r.z.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: B = None
        self.p: D = None
        self.r: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

j.q = c
j.p = c
j.y = b
j.r = b
b.r = m
b.v = m
b.z = k
m.q = n
m.u = h
m.w = b
m.r = b
m.z = c
c.r = i
c.t = m
c.p = d
n.t = j
h.q = d
h.u = m
h.w = b
h.r = b
h.z = c
d.t = j
i.q = c
i.p = c
i.y = b
i.r = b
l.q = c
l.p = c
l.y = b
l.r = b
k.t = i
assert b.z.t.q.p.t.r.r.z.p.t.txt == "j"