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

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

m.v = f
m.q = f
m.r = f
m.z = g
k.x = f
i.s = b
l.o = k
l.v = g
f.r = i
f.p = l
f.w = m
f.o = m
f.s = b
g.s = l
b.o = k
b.v = i
assert g.s.v.s.txt == "l"