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

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

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

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

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

e = A("e")
b = B("b")
d = C("d")
n = D("n")
f = E("f")

e.y = n
e.z = d
b.s = f
b.z = e
b.u = d
b.p = n
d.z = f
d.x = e
n.v = d
f.o = e
f.x = d
assert b.p.v.x.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: C = None
        self.txt = txt

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

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

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

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

e = A("e")
b = B("b")
d = C("d")
n = D("n")
f = E("f")

e.y = n
e.z = d
b.s = f
b.z = e
b.u = d
b.p = n
d.z = f
d.x = e
n.v = d
f.o = e
f.x = d
assert b.p.v.x.y.v.txt == "d"