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

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

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

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

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

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

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

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

c.s = m
c.u = i
c.v = n
k.x = b
n.x = f
n.o = m
a.x = h
i.x = h
h.s = e
h.u = a
h.v = m
m.x = i
m.o = e
b.s = n
b.u = k
b.v = e
f.x = c
e.x = a
e.o = n
assert c.v.x.x.s.o.o.x.txt == "f"