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

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

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

a = A("a")
b = B("b")
g = C("g")
n = C("n")
k = A("k")
c = B("c")
h = B("h")

a.v = k
a.w = k
b.x = k
b.u = c
b.w = g
g.s = n
g.o = a
n.s = g
n.o = k
k.v = a
k.w = a
c.x = a
c.u = h
c.w = n
h.x = a
h.u = b
h.w = n
assert b.u.w.s.o.v.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: A = None
        self.txt = txt

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

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

a = A("a")
b = B("b")
g = C("g")
n = C("n")
k = A("k")
c = B("c")
h = B("h")

a.v = k
a.w = k
b.x = k
b.u = c
b.w = g
g.s = n
g.o = a
n.s = g
n.o = k
k.v = a
k.w = a
c.x = a
c.u = h
c.w = n
h.x = a
h.u = b
h.w = n
assert b.u.w.s.o.v.w.w.txt == "k"