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

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

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

c = A("c")
l = B("l")
a = C("a")
f = C("f")

c.t = a
c.q = f
c.o = l
l.q = c
l.v = c
l.r = c
a.u = l
f.u = l
assert f.u.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: C = None
        self.o: B = None
        self.txt = txt

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

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

c = A("c")
l = B("l")
a = C("a")
f = C("f")

c.t = a
c.q = f
c.o = l
l.q = c
l.v = c
l.r = c
a.u = l
f.u = l
assert f.u.q.q.txt == "f"