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

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

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

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

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

g = A("g")
n = B("n")
h = C("h")
m = D("m")
e = E("e")
f = D("f")
j = E("j")
a = D("a")

g.w = h
g.r = e
g.u = a
n.q = m
n.x = h
h.q = n
h.p = g
h.v = m
m.x = n
m.s = a
m.r = h
m.u = g
e.s = g
e.o = f
e.q = n
f.x = n
f.s = m
f.r = h
f.u = g
j.s = g
j.o = f
j.q = n
a.x = n
a.s = f
a.r = h
a.u = g
assert m.r.v.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.r: E = None
        self.u: D = None
        self.txt = txt

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

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

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

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

g = A("g")
n = B("n")
h = C("h")
m = D("m")
e = E("e")
f = D("f")
j = E("j")
a = D("a")

g.w = h
g.r = e
g.u = a
n.q = m
n.x = h
h.q = n
h.p = g
h.v = m
m.x = n
m.s = a
m.r = h
m.u = g
e.s = g
e.o = f
e.q = n
f.x = n
f.s = m
f.r = h
f.u = g
j.s = g
j.o = f
j.q = n
a.x = n
a.s = f
a.r = h
a.u = g
assert m.r.v.x.x.txt == "h"