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

d = A("d")
n = B("n")
a = C("a")
l = C("l")
e = A("e")
c = C("c")
b = A("b")
f = C("f")
g = B("g")

d.t = a
d.v = g
n.v = b
a.u = g
a.v = n
a.w = l
l.u = g
l.v = n
l.w = a
e.t = c
e.v = n
c.u = g
c.v = n
c.w = f
b.t = a
b.v = g
f.u = g
f.v = g
f.w = c
g.v = b
assert d.v.v.t.w.w.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: B = 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.u: B = None
        self.v: B = None
        self.w: C = None
        self.txt = txt

d = A("d")
n = B("n")
a = C("a")
l = C("l")
e = A("e")
c = C("c")
b = A("b")
f = C("f")
g = B("g")

d.t = a
d.v = g
n.v = b
a.u = g
a.v = n
a.w = l
l.u = g
l.v = n
l.w = a
e.t = c
e.v = n
c.u = g
c.v = n
c.w = f
b.t = a
b.v = g
f.u = g
f.v = g
f.w = c
g.v = b
assert d.v.v.t.w.w.u.v.txt == "b"