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

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

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

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

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

i = A("i")
g = B("g")
m = C("m")
n = D("n")
k = E("k")
b = D("b")

i.w = m
i.p = m
i.u = g
i.v = g
g.s = n
g.u = n
g.o = m
g.p = k
g.r = b
m.o = k
n.q = i
n.s = k
n.w = k
n.p = k
k.x = i
k.v = m
b.q = i
b.s = k
b.w = k
b.p = k
assert m.o.v.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: B = None
        self.v: B = None
        self.p: C = None
        self.txt = txt

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

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

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

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

i = A("i")
g = B("g")
m = C("m")
n = D("n")
k = E("k")
b = D("b")

i.w = m
i.p = m
i.u = g
i.v = g
g.s = n
g.u = n
g.o = m
g.p = k
g.r = b
m.o = k
n.q = i
n.s = k
n.w = k
n.p = k
k.x = i
k.v = m
b.q = i
b.s = k
b.w = k
b.p = k
assert m.o.v.o.x.txt == "i"