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

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

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

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

e.r = f
i.y = e
i.p = e
i.s = n
l.v = f
l.q = f
l.z = e
f.v = l
f.q = l
f.z = e
n.y = e
n.p = e
n.s = i
assert l.z.r.z.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

e.r = f
i.y = e
i.p = e
i.s = n
l.v = f
l.q = f
l.z = e
f.v = l
f.q = l
f.z = e
n.y = e
n.p = e
n.s = i
assert l.z.r.z.r.q.txt == "l"