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

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

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

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

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

m = A("m")
e = B("e")
k = C("k")
c = D("c")
a = E("a")
f = D("f")
n = E("n")
j = E("j")
g = D("g")
l = D("l")

m.y = f
e.w = m
k.t = g
k.v = m
k.x = m
c.p = k
c.q = e
a.w = m
a.x = j
a.q = f
f.p = k
f.q = e
n.w = m
n.x = j
n.q = c
j.w = m
j.x = n
j.q = l
g.p = k
g.q = e
l.p = k
l.q = e
assert a.q.p.x.y.p.x.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

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

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

m = A("m")
e = B("e")
k = C("k")
c = D("c")
a = E("a")
f = D("f")
n = E("n")
j = E("j")
g = D("g")
l = D("l")

m.y = f
e.w = m
k.t = g
k.v = m
k.x = m
c.p = k
c.q = e
a.w = m
a.x = j
a.q = f
f.p = k
f.q = e
n.w = m
n.x = j
n.q = c
j.w = m
j.x = n
j.q = l
g.p = k
g.q = e
l.p = k
l.q = e
assert a.q.p.x.y.p.x.y.q.txt == "e"