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

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

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

i = A("i")
n = B("n")
l = C("l")
k = C("k")
b = A("b")

i.x = k
i.y = b
n.p = b
n.s = b
n.y = k
l.u = i
k.u = i
b.x = l
b.y = i
assert b.y.x.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: A = None
        self.txt = txt

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

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

i = A("i")
n = B("n")
l = C("l")
k = C("k")
b = A("b")

i.x = k
i.y = b
n.p = b
n.s = b
n.y = k
l.u = i
k.u = i
b.x = l
b.y = i
assert b.y.x.u.x.txt == "k"