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

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

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

a = A("a")
n = B("n")
l = C("l")
e = A("e")

a.o = l
a.p = l
a.y = e
n.p = l
l.p = a
e.o = l
e.p = l
e.y = a
assert n.p.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.y: A = None
        self.p: C = None
        self.txt = txt

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

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

a = A("a")
n = B("n")
l = C("l")
e = A("e")

a.o = l
a.p = l
a.y = e
n.p = l
l.p = a
e.o = l
e.p = l
e.y = a
assert n.p.p.y.txt == "e"