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.q: B = None
        self.s: B = None
        self.o: A = None
        self.txt = txt

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

b = A("b")
j = B("j")
i = C("i")
f = C("f")
d = B("d")
k = A("k")

b.v = k
b.z = j
j.q = d
j.s = d
j.o = k
i.t = j
i.v = d
i.s = k
f.t = j
f.v = j
f.s = b
d.q = j
d.s = j
d.o = k
k.v = b
k.z = j
assert i.s.v.z.o.v.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.q: B = None
        self.s: B = None
        self.o: A = None
        self.txt = txt

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

b = A("b")
j = B("j")
i = C("i")
f = C("f")
d = B("d")
k = A("k")

b.v = k
b.z = j
j.q = d
j.s = d
j.o = k
i.t = j
i.v = d
i.s = k
f.t = j
f.v = j
f.s = b
d.q = j
d.s = j
d.o = k
k.v = b
k.z = j
assert i.s.v.z.o.v.txt == "b"