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

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

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

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

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

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

i.q = h
i.p = b
i.o = c
j.x = m
j.r = a
j.w = c
j.s = h
l.o = h
l.y = b
h.z = i
h.o = i
h.x = l
b.p = j
b.x = h
b.z = h
a.q = h
a.p = b
a.o = l
c.o = h
c.y = b
m.x = j
m.r = a
m.w = c
m.s = h
assert j.x.r.p.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: E = None
        self.o: C = None
        self.txt = txt

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

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

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

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

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

i.q = h
i.p = b
i.o = c
j.x = m
j.r = a
j.w = c
j.s = h
l.o = h
l.y = b
h.z = i
h.o = i
h.x = l
b.p = j
b.x = h
b.z = h
a.q = h
a.p = b
a.o = l
c.o = h
c.y = b
m.x = j
m.r = a
m.w = c
m.s = h
assert j.x.r.p.z.x.txt == "l"