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

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

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

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

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

j = A("j")
d = B("d")
f = C("f")
m = D("m")
l = E("l")
a = A("a")
e = A("e")
h = E("h")

j.o = f
d.u = h
d.x = e
d.w = m
d.o = l
f.q = d
m.p = d
m.y = d
m.u = a
m.o = h
l.p = m
l.u = m
l.x = h
l.t = d
a.o = f
e.o = f
h.p = m
h.u = m
h.x = l
h.t = d
assert m.u.o.q.o.t.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

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

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

j = A("j")
d = B("d")
f = C("f")
m = D("m")
l = E("l")
a = A("a")
e = A("e")
h = E("h")

j.o = f
d.u = h
d.x = e
d.w = m
d.o = l
f.q = d
m.p = d
m.y = d
m.u = a
m.o = h
l.p = m
l.u = m
l.x = h
l.t = d
a.o = f
e.o = f
h.p = m
h.u = m
h.x = l
h.t = d
assert m.u.o.q.o.t.w.u.txt == "a"