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

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

class C:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: A = None
        self.x: A = None
        self.txt = txt

c = A("c")
k = B("k")
n = C("n")
a = C("a")
l = B("l")

c.x = a
c.t = k
c.s = n
k.x = l
k.r = l
k.w = c
n.o = a
n.q = c
n.x = c
a.o = n
a.q = c
a.x = c
l.x = k
l.r = k
l.w = c
assert l.w.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.t: B = None
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: A = None
        self.x: A = None
        self.txt = txt

c = A("c")
k = B("k")
n = C("n")
a = C("a")
l = B("l")

c.x = a
c.t = k
c.s = n
k.x = l
k.r = l
k.w = c
n.o = a
n.q = c
n.x = c
a.o = n
a.q = c
a.x = c
l.x = k
l.r = k
l.w = c
assert l.w.t.w.txt == "c"