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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: D = None
        self.w: E = 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.v: C = None
        self.s: A = None
        self.u: D = None
        self.p: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: D = None
        self.w: E = 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.v: C = None
        self.s: A = None
        self.u: D = None
        self.p: B = None
        self.txt = txt

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

m.o = n
m.y = k
j.q = k
j.x = n
j.t = n
j.p = a
j.o = g
n.y = j
n.z = a
n.w = b
a.w = k
b.v = n
b.s = m
b.u = a
b.p = k
g.o = n
g.y = k
k.q = j
k.x = n
k.t = n
k.p = a
k.o = g
assert m.y.x.w.u.w.o.txt == "g"