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

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

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

f = A("f")
b = B("b")
i = C("i")
c = B("c")
m = B("m")
e = C("e")
h = A("h")
d = A("d")
n = A("n")
a = A("a")

f.v = n
f.z = b
b.x = i
b.v = n
i.u = h
c.x = e
c.v = d
m.x = i
m.v = a
e.u = f
h.v = f
h.z = m
d.v = n
d.z = m
n.v = a
n.z = m
a.v = d
a.z = c
assert b.v.z.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: B = None
        self.txt = txt

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

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

f = A("f")
b = B("b")
i = C("i")
c = B("c")
m = B("m")
e = C("e")
h = A("h")
d = A("d")
n = A("n")
a = A("a")

f.v = n
f.z = b
b.x = i
b.v = n
i.u = h
c.x = e
c.v = d
m.x = i
m.v = a
e.u = f
h.v = f
h.z = m
d.v = n
d.z = m
n.v = a
n.z = m
a.v = d
a.z = c
assert b.v.z.x.u.txt == "h"