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

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: C = None
        self.v: D = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: C = None
        self.v: D = None
        self.txt = txt

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

n.s = k
n.w = k
n.v = k
n.o = b
c.s = b
a.q = b
a.v = k
a.x = m
f.q = b
f.y = b
f.v = m
m.q = b
m.y = b
m.v = f
b.q = a
b.v = n
b.x = f
h.s = a
k.s = n
k.w = n
k.v = n
k.o = b
assert a.q.v.v.o.q.v.o.v.txt == "n"