class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.z: E = None
        self.x: E = None
        self.s: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.x: E = None
        self.v: B = None
        self.z: A = None
        self.txt = txt

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

a = A("a")
g = B("g")
b = C("b")
d = D("d")
e = E("e")
h = B("h")
k = C("k")
m = B("m")
i = D("i")
l = D("l")

a.q = i
a.z = e
a.x = e
a.s = m
g.w = a
g.v = e
g.y = l
b.p = e
d.u = a
d.z = a
d.x = e
d.v = g
e.z = a
e.r = a
e.u = b
h.w = a
h.v = e
h.y = d
k.p = e
m.w = a
m.v = e
m.y = d
i.u = a
i.z = a
i.x = e
i.v = h
l.u = a
l.z = a
l.x = e
l.v = m
assert e.u.p.u.p.u.p.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.z: E = None
        self.x: E = None
        self.s: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.x: E = None
        self.v: B = None
        self.z: A = None
        self.txt = txt

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

a = A("a")
g = B("g")
b = C("b")
d = D("d")
e = E("e")
h = B("h")
k = C("k")
m = B("m")
i = D("i")
l = D("l")

a.q = i
a.z = e
a.x = e
a.s = m
g.w = a
g.v = e
g.y = l
b.p = e
d.u = a
d.z = a
d.x = e
d.v = g
e.z = a
e.r = a
e.u = b
h.w = a
h.v = e
h.y = d
k.p = e
m.w = a
m.v = e
m.y = d
i.u = a
i.z = a
i.x = e
i.v = h
l.u = a
l.z = a
l.x = e
l.v = m
assert e.u.p.u.p.u.p.u.p.txt == "e"