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

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

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

l = A("l")
b = B("b")
i = C("i")
d = B("d")
c = C("c")
e = B("e")

l.y = d
l.v = c
l.t = c
b.r = l
b.s = l
i.r = b
i.s = l
i.y = l
d.r = l
d.s = l
c.r = b
c.s = l
c.y = l
e.r = l
e.s = l
assert c.r.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.v: C = None
        self.t: C = None
        self.txt = txt

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

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

l = A("l")
b = B("b")
i = C("i")
d = B("d")
c = C("c")
e = B("e")

l.y = d
l.v = c
l.t = c
b.r = l
b.s = l
i.r = b
i.s = l
i.y = l
d.r = l
d.s = l
c.r = b
c.s = l
c.y = l
e.r = l
e.s = l
assert c.r.s.v.txt == "c"