class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: A = 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.r: C = None
        self.t: C = None
        self.txt = txt

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

g.v = a
g.u = m
k.v = g
f.r = l
f.t = l
m.v = g
m.u = g
j.v = a
l.r = f
l.t = f
a.v = g
a.u = g
assert m.u.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: A = 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.r: C = None
        self.t: C = None
        self.txt = txt

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

g.v = a
g.u = m
k.v = g
f.r = l
f.t = l
m.v = g
m.u = g
j.v = a
l.r = f
l.t = f
a.v = g
a.u = g
assert m.u.v.v.txt == "g"