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

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

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

g = A("g")
f = B("f")
n = C("n")
b = B("b")
l = A("l")

g.r = n
g.s = n
f.u = l
f.q = b
f.o = b
n.v = b
n.y = f
b.u = l
b.q = f
b.o = f
l.r = n
l.s = n
assert b.q.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: C = None
        self.txt = txt

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

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

g = A("g")
f = B("f")
n = C("n")
b = B("b")
l = A("l")

g.r = n
g.s = n
f.u = l
f.q = b
f.o = b
n.v = b
n.y = f
b.u = l
b.q = f
b.o = f
l.r = n
l.s = n
assert b.q.u.s.txt == "n"