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

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

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

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

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

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

h.u = a
h.s = m
g.r = m
m.o = b
m.t = l
m.x = g
a.u = m
a.z = m
a.t = g
a.p = b
l.w = g
l.o = g
i.w = g
i.o = g
b.u = m
b.z = m
b.t = g
b.p = a
assert l.o.r.t.w.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: C = None
        self.txt = txt

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

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

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

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

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

h.u = a
h.s = m
g.r = m
m.o = b
m.t = l
m.x = g
a.u = m
a.z = m
a.t = g
a.p = b
l.w = g
l.o = g
i.w = g
i.o = g
b.u = m
b.z = m
b.t = g
b.p = a
assert l.o.r.t.w.r.o.txt == "b"