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

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

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

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

g.u = n
g.v = m
f.v = l
j.t = a
a.t = j
n.v = l
b.v = g
m.t = j
l.u = n
l.v = a
assert l.v.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: C = None
        self.txt = txt

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

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

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

g.u = n
g.v = m
f.v = l
j.t = a
a.t = j
n.v = l
b.v = g
m.t = j
l.u = n
l.v = a
assert l.v.t.t.txt == "a"