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

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

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

l = A("l")
i = B("i")
g = C("g")
n = C("n")

l.u = i
i.o = g
g.v = n
n.v = g
assert l.u.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

l = A("l")
i = B("i")
g = C("g")
n = C("n")

l.u = i
i.o = g
g.v = n
n.v = g
assert l.u.o.v.txt == "n"