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.z: C = None
        self.txt = txt

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

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

m.v = i
m.u = c
c.t = j
c.z = d
g.v = k
j.t = f
j.z = d
b.v = a
b.u = j
d.v = i
k.v = i
k.u = c
i.v = k
i.u = f
f.t = c
f.z = g
a.v = k
a.u = f
assert j.t.z.v.v.u.z.v.v.u.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.z: C = None
        self.txt = txt

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

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

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