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

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

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

l = A("l")
f = B("f")
e = C("e")
g = C("g")
c = C("c")

l.t = f
f.w = c
f.u = c
f.o = l
e.q = l
e.o = g
g.q = l
g.o = e
c.q = l
c.o = g
assert e.o.q.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

l = A("l")
f = B("f")
e = C("e")
g = C("g")
c = C("c")

l.t = f
f.w = c
f.u = c
f.o = l
e.q = l
e.o = g
g.q = l
g.o = e
c.q = l
c.o = g
assert e.o.q.t.u.txt == "c"