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

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

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

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

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

d = A("d")
i = B("i")
e = C("e")
g = D("g")
b = E("b")

d.v = b
i.v = e
i.o = e
e.t = d
e.p = b
g.z = i
g.s = i
g.r = b
g.u = b
g.o = e
b.o = i
b.u = i
b.z = e
b.r = e
assert i.o.t.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

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

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

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

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

d = A("d")
i = B("i")
e = C("e")
g = D("g")
b = E("b")

d.v = b
i.v = e
i.o = e
e.t = d
e.p = b
g.z = i
g.s = i
g.r = b
g.u = b
g.o = e
b.o = i
b.u = i
b.z = e
b.r = e
assert i.o.t.v.o.txt == "i"