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

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

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

g = A("g")
n = B("n")
d = C("d")
h = A("h")
j = A("j")
m = C("m")
e = A("e")
l = B("l")
k = C("k")

g.v = l
g.x = n
g.o = m
n.s = j
n.q = m
n.t = l
d.v = n
d.w = n
h.v = n
h.x = l
h.o = d
j.v = n
j.x = l
j.o = m
m.v = n
m.w = l
e.v = n
e.x = n
e.o = k
l.s = g
l.q = d
l.t = n
k.v = l
k.w = n
assert j.x.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: B = None
        self.o: C = None
        self.txt = txt

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

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

g = A("g")
n = B("n")
d = C("d")
h = A("h")
j = A("j")
m = C("m")
e = A("e")
l = B("l")
k = C("k")

g.v = l
g.x = n
g.o = m
n.s = j
n.q = m
n.t = l
d.v = n
d.w = n
h.v = n
h.x = l
h.o = d
j.v = n
j.x = l
j.o = m
m.v = n
m.w = l
e.v = n
e.x = n
e.o = k
l.s = g
l.q = d
l.t = n
k.v = l
k.w = n
assert j.x.q.w.txt == "n"