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

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

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

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

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

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

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

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

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

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

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

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

e.z = f
e.q = f
m.p = a
m.z = l
m.s = e
m.q = f
b.p = i
b.w = f
l.z = b
l.x = i
f.q = a
d.p = i
d.w = f
i.z = f
i.q = f
h.p = b
h.z = l
h.s = i
h.q = f
g.p = a
g.z = l
g.s = i
g.q = f
a.p = e
a.w = f
assert l.x.q.q.w.q.w.q.w.txt == "f"