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

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

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

h = A("h")
f = B("f")
a = C("a")
b = A("b")
e = A("e")
k = C("k")
d = C("d")
g = A("g")
n = B("n")
m = B("m")

h.x = g
h.v = f
h.q = k
f.o = d
a.u = f
a.w = n
a.y = n
b.x = h
b.v = n
b.q = k
e.x = g
e.v = n
e.q = a
k.u = m
k.w = f
k.y = n
d.u = f
d.w = f
d.y = f
g.x = h
g.v = f
g.q = k
n.o = d
m.o = k
assert h.q.y.o.w.o.y.o.u.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.v: B = None
        self.q: C = None
        self.txt = txt

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

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

h = A("h")
f = B("f")
a = C("a")
b = A("b")
e = A("e")
k = C("k")
d = C("d")
g = A("g")
n = B("n")
m = B("m")

h.x = g
h.v = f
h.q = k
f.o = d
a.u = f
a.w = n
a.y = n
b.x = h
b.v = n
b.q = k
e.x = g
e.v = n
e.q = a
k.u = m
k.w = f
k.y = n
d.u = f
d.w = f
d.y = f
g.x = h
g.v = f
g.q = k
n.o = d
m.o = k
assert h.q.y.o.w.o.y.o.u.o.u.txt == "f"