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

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

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

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

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

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

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

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

b.y = l
b.q = i
e.q = b
e.y = i
l.t = b
l.v = b
i.q = b
i.y = e
assert e.y.y.q.txt == "b"