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

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

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

k = A("k")
d = B("d")
m = C("m")
i = A("i")
c = A("c")
j = B("j")
l = A("l")
b = A("b")
g = C("g")
e = B("e")

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

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

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

k = A("k")
d = B("d")
m = C("m")
i = A("i")
c = A("c")
j = B("j")
l = A("l")
b = A("b")
g = C("g")
e = B("e")

k.u = d
k.v = i
d.w = e
m.y = b
m.t = g
m.w = j
i.u = j
i.v = k
c.u = j
c.v = b
j.w = e
l.u = j
l.v = c
b.u = d
b.v = l
g.y = i
g.t = m
g.w = j
e.w = j
assert e.w.w.w.w.w.w.w.txt == "j"