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

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

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

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

e.p = l
e.z = n
n.r = l
l.u = n
l.x = n
l.r = e
f.p = l
f.z = n
assert n.r.u.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: B = None
        self.txt = txt

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

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

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

e.p = l
e.z = n
n.r = l
l.u = n
l.x = n
l.r = e
f.p = l
f.z = n
assert n.r.u.r.r.txt == "e"