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

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

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

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

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

m = A("m")
b = B("b")
j = C("j")
g = D("g")
e = E("e")
k = C("k")
h = E("h")
n = D("n")

m.o = n
m.w = g
b.x = k
j.o = m
g.x = m
g.s = m
g.y = h
g.t = n
e.q = m
e.o = m
e.p = b
e.w = b
e.s = h
k.o = m
h.q = m
h.o = m
h.p = b
h.w = b
h.s = e
n.x = m
n.s = m
n.y = h
n.t = g
assert h.o.o.y.w.x.o.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.w: D = None
        self.txt = txt

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

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

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

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

m = A("m")
b = B("b")
j = C("j")
g = D("g")
e = E("e")
k = C("k")
h = E("h")
n = D("n")

m.o = n
m.w = g
b.x = k
j.o = m
g.x = m
g.s = m
g.y = h
g.t = n
e.q = m
e.o = m
e.p = b
e.w = b
e.s = h
k.o = m
h.q = m
h.o = m
h.p = b
h.w = b
h.s = e
n.x = m
n.s = m
n.y = h
n.t = g
assert h.o.o.y.w.x.o.w.x.txt == "m"