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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

m = A("m")
l = B("l")
i = C("i")
a = D("a")
h = E("h")
c = A("c")
j = C("j")
k = D("k")

m.x = a
m.r = l
l.t = a
i.x = k
i.q = k
i.s = l
a.p = k
a.y = l
h.s = i
h.x = i
h.y = l
h.v = l
c.x = k
c.r = l
j.x = a
j.q = a
j.s = l
k.p = a
k.y = l
assert j.q.y.t.y.t.p.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

m = A("m")
l = B("l")
i = C("i")
a = D("a")
h = E("h")
c = A("c")
j = C("j")
k = D("k")

m.x = a
m.r = l
l.t = a
i.x = k
i.q = k
i.s = l
a.p = k
a.y = l
h.s = i
h.x = i
h.y = l
h.v = l
c.x = k
c.r = l
j.x = a
j.q = a
j.s = l
k.p = a
k.y = l
assert j.q.y.t.y.t.p.y.t.txt == "a"