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

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

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

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

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

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

i.p = h
i.s = b
i.v = b
i.q = d
i.o = m
m.o = h
e.o = d
e.x = d
e.w = d
e.r = b
e.q = b
d.r = m
d.y = m
d.o = m
d.x = m
b.x = e
h.p = i
h.s = b
h.v = b
h.q = d
h.o = m
assert m.o.p.s.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: E = None
        self.q: D = None
        self.o: B = None
        self.v: E = None
        self.txt = txt

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

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

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

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

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

i.p = h
i.s = b
i.v = b
i.q = d
i.o = m
m.o = h
e.o = d
e.x = d
e.w = d
e.r = b
e.q = b
d.r = m
d.y = m
d.o = m
d.x = m
b.x = e
h.p = i
h.s = b
h.v = b
h.q = d
h.o = m
assert m.o.p.s.x.q.txt == "b"