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

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

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

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

k.o = c
l.u = i
l.t = j
i.p = d
d.o = c
j.o = i
c.p = k
assert l.t.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

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

k.o = c
l.u = i
l.t = j
i.p = d
d.o = c
j.o = i
c.p = k
assert l.t.o.p.txt == "d"