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

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

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

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

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

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

k.s = n
k.w = n
k.v = b
a.x = f
a.z = b
a.p = b
a.o = g
a.r = n
n.u = a
n.y = f
f.w = a
f.z = n
f.v = n
f.s = k
f.u = k
b.o = a
b.x = n
g.x = f
g.z = b
g.p = b
g.o = a
g.r = n
assert a.x.s.v.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: E = None
        self.w: C = None
        self.txt = txt

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

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

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

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

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

k.s = n
k.w = n
k.v = b
a.x = f
a.z = b
a.p = b
a.o = g
a.r = n
n.u = a
n.y = f
f.w = a
f.z = n
f.v = n
f.s = k
f.u = k
b.o = a
b.x = n
g.x = f
g.z = b
g.p = b
g.o = a
g.r = n
assert a.x.s.v.o.z.txt == "b"