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

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

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

i = A("i")
c = B("c")
l = C("l")
k = A("k")
j = C("j")

i.z = l
c.q = l
l.s = k
l.w = c
k.z = l
j.s = k
j.w = c
assert j.w.q.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

i = A("i")
c = B("c")
l = C("l")
k = A("k")
j = C("j")

i.z = l
c.q = l
l.s = k
l.w = c
k.z = l
j.s = k
j.w = c
assert j.w.q.w.q.txt == "l"