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

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

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

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

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

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

m.y = h
e.o = d
e.u = d
e.x = a
e.t = c
b.s = d
c.w = b
c.x = b
c.u = d
c.r = d
a.r = j
a.t = e
n.y = c
d.o = e
d.u = e
d.x = i
d.t = c
i.r = a
i.t = e
h.w = b
h.x = b
h.u = d
h.r = e
j.r = i
j.t = d
assert b.s.o.x.t.t.w.s.t.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

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

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

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

m.y = h
e.o = d
e.u = d
e.x = a
e.t = c
b.s = d
c.w = b
c.x = b
c.u = d
c.r = d
a.r = j
a.t = e
n.y = c
d.o = e
d.u = e
d.x = i
d.t = c
i.r = a
i.t = e
h.w = b
h.x = b
h.u = d
h.r = e
j.r = i
j.t = d
assert b.s.o.x.t.t.w.s.t.u.t.txt == "c"