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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: A = None
        self.r: D = None
        self.v: D = None
        self.y: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

f = A("f")
j = B("j")
g = C("g")
e = D("e")
i = E("i")

f.v = i
f.u = e
f.s = e
j.w = f
j.z = f
j.y = f
j.r = e
j.v = e
g.z = j
e.s = g
e.w = f
i.u = g
i.v = f
i.o = e
i.r = e
assert g.z.v.w.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.u: D = None
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: A = None
        self.r: D = None
        self.v: D = None
        self.y: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

f = A("f")
j = B("j")
g = C("g")
e = D("e")
i = E("i")

f.v = i
f.u = e
f.s = e
j.w = f
j.z = f
j.y = f
j.r = e
j.v = e
g.z = j
e.s = g
e.w = f
i.u = g
i.v = f
i.o = e
i.r = e
assert g.z.v.w.v.o.txt == "e"