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

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

k = A("k")
f = B("f")
c = A("c")
l = A("l")
j = B("j")

k.v = l
k.z = f
f.x = j
c.v = l
c.z = j
l.v = k
l.z = j
j.x = f
assert c.v.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: B = None
        self.txt = txt

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

k = A("k")
f = B("f")
c = A("c")
l = A("l")
j = B("j")

k.v = l
k.z = f
f.x = j
c.v = l
c.z = j
l.v = k
l.z = j
j.x = f
assert c.v.z.x.txt == "f"