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

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

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

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

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

g = A("g")
n = B("n")
h = C("h")
i = D("i")
j = E("j")
m = B("m")

g.u = n
g.q = i
g.v = i
g.s = j
n.u = g
n.x = j
h.y = m
h.o = m
h.s = j
h.p = j
i.x = j
i.v = n
i.r = h
i.o = h
j.x = m
j.z = h
j.s = h
j.u = h
j.y = g
m.u = g
m.x = j
assert m.x.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: D = None
        self.v: D = None
        self.s: E = None
        self.txt = txt

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

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

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

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

g = A("g")
n = B("n")
h = C("h")
i = D("i")
j = E("j")
m = B("m")

g.u = n
g.q = i
g.v = i
g.s = j
n.u = g
n.x = j
h.y = m
h.o = m
h.s = j
h.p = j
i.x = j
i.v = n
i.r = h
i.o = h
j.x = m
j.z = h
j.s = h
j.u = h
j.y = g
m.u = g
m.x = j
assert m.x.y.s.txt == "j"