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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.o: C = None
        self.y: E = None
        self.s: D = None
        self.t: D = None
        self.txt = txt

f = A("f")
k = B("k")
m = C("m")
j = D("j")
e = E("e")
g = A("g")
h = A("h")
d = E("d")

f.q = j
f.y = j
f.w = m
f.p = m
k.u = d
m.r = e
j.q = g
e.x = m
e.o = m
e.y = d
e.s = j
e.t = j
g.q = j
g.y = j
g.w = m
g.p = m
h.q = j
h.y = j
h.w = m
h.p = m
d.x = m
d.o = m
d.y = e
d.s = j
d.t = j
assert e.y.t.q.q.q.q.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: C = None
        self.y: D = None
        self.p: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.o: C = None
        self.y: E = None
        self.s: D = None
        self.t: D = None
        self.txt = txt

f = A("f")
k = B("k")
m = C("m")
j = D("j")
e = E("e")
g = A("g")
h = A("h")
d = E("d")

f.q = j
f.y = j
f.w = m
f.p = m
k.u = d
m.r = e
j.q = g
e.x = m
e.o = m
e.y = d
e.s = j
e.t = j
g.q = j
g.y = j
g.w = m
g.p = m
h.q = j
h.y = j
h.w = m
h.p = m
d.x = m
d.o = m
d.y = e
d.s = j
d.t = j
assert e.y.t.q.q.q.q.q.w.txt == "m"