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

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

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

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

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

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

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

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

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

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

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

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

k.z = d
b.x = k
b.q = e
b.y = m
m.x = e
m.y = e
m.s = b
m.w = l
d.p = l
d.s = e
e.y = h
c.p = l
c.s = e
l.x = e
l.y = e
l.s = i
l.w = m
h.p = m
h.s = e
i.x = k
i.q = e
i.y = l
assert i.x.z.p.txt == "l"