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

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

i = A("i")
j = B("j")
g = A("g")
c = A("c")
b = A("b")
k = B("k")
e = B("e")

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

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

i = A("i")
j = B("j")
g = A("g")
c = A("c")
b = A("b")
k = B("k")
e = B("e")

i.v = g
i.u = j
j.t = e
j.u = k
g.v = c
g.u = j
c.v = b
c.u = k
b.v = g
b.u = e
k.t = e
k.u = e
e.t = k
e.u = k
assert g.v.u.t.u.t.txt == "e"