class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: E = None
        self.q: B = None
        self.v: E = None
        self.y: B = None
        self.txt = txt

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

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

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

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

f = A("f")
e = B("e")
m = C("m")
b = D("b")
k = E("k")

f.z = e
f.q = e
f.y = e
f.u = k
f.v = k
e.p = f
e.x = f
e.s = b
e.u = b
m.s = b
m.v = f
b.s = f
k.p = f
assert e.p.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: E = None
        self.q: B = None
        self.v: E = None
        self.y: B = None
        self.txt = txt

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

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

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

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

f = A("f")
e = B("e")
m = C("m")
b = D("b")
k = E("k")

f.z = e
f.q = e
f.y = e
f.u = k
f.v = k
e.p = f
e.x = f
e.s = b
e.u = b
m.s = b
m.v = f
b.s = f
k.p = f
assert e.p.v.p.txt == "f"