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

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

a = A("a")
g = B("g")
j = B("j")
k = A("k")
c = B("c")
i = B("i")
f = B("f")
m = A("m")
l = A("l")
b = A("b")

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

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

a = A("a")
g = B("g")
j = B("j")
k = A("k")
c = B("c")
i = B("i")
f = B("f")
m = A("m")
l = A("l")
b = A("b")

a.u = l
a.v = c
g.t = l
g.v = m
j.t = b
j.v = k
k.u = m
k.v = j
c.t = b
c.v = b
i.t = b
i.v = m
f.t = a
f.v = k
m.u = k
m.v = c
l.u = b
l.v = g
b.u = l
b.v = j
assert c.v.v.t.txt == "b"