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

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

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

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

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

f = A("f")
d = B("d")
k = C("k")
j = D("j")
l = E("l")

f.s = k
f.z = j
f.o = d
d.p = l
d.s = f
k.z = l
k.v = l
k.p = l
k.o = l
j.v = d
l.o = k
assert l.o.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: D = None
        self.o: B = None
        self.txt = txt

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

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

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

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

f = A("f")
d = B("d")
k = C("k")
j = D("j")
l = E("l")

f.s = k
f.z = j
f.o = d
d.p = l
d.s = f
k.z = l
k.v = l
k.p = l
k.o = l
j.v = d
l.o = k
assert l.o.p.o.txt == "k"