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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: A = None
        self.x: B = None
        self.p: B = None
        self.u: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: A = None
        self.p: C = None
        self.r: A = None
        self.o: A = None
        self.txt = txt

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

k.q = d
j.v = a
a.w = k
a.z = k
a.x = j
a.p = h
a.u = b
b.q = m
b.y = i
d.w = m
d.y = k
d.r = k
d.o = k
d.p = a
i.q = m
i.y = b
m.q = d
n.w = m
n.y = m
n.p = a
n.r = k
n.o = k
h.v = a
assert b.y.q.q.r.q.r.q.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: A = None
        self.x: B = None
        self.p: B = None
        self.u: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: A = None
        self.p: C = None
        self.r: A = None
        self.o: A = None
        self.txt = txt

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

k.q = d
j.v = a
a.w = k
a.z = k
a.x = j
a.p = h
a.u = b
b.q = m
b.y = i
d.w = m
d.y = k
d.r = k
d.o = k
d.p = a
i.q = m
i.y = b
m.q = d
n.w = m
n.y = m
n.p = a
n.r = k
n.o = k
h.v = a
assert b.y.q.q.r.q.r.q.r.q.txt == "d"