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

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

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

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

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

e = A("e")
n = B("n")
m = C("m")
j = D("j")
h = E("h")
d = B("d")

e.x = h
e.w = h
e.y = m
e.u = m
e.o = n
n.o = e
n.v = h
n.w = d
m.p = j
m.r = d
m.w = d
m.t = n
m.x = e
j.w = n
h.r = j
h.t = e
d.o = e
d.v = h
d.w = n
assert m.w.v.t.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.y: C = None
        self.o: B = None
        self.u: C = None
        self.w: E = None
        self.txt = txt

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

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

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

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

e = A("e")
n = B("n")
m = C("m")
j = D("j")
h = E("h")
d = B("d")

e.x = h
e.w = h
e.y = m
e.u = m
e.o = n
n.o = e
n.v = h
n.w = d
m.p = j
m.r = d
m.w = d
m.t = n
m.x = e
j.w = n
h.r = j
h.t = e
d.o = e
d.v = h
d.w = n
assert m.w.v.t.w.r.txt == "j"