class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: D = None
        self.w: B = 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.v: C = None
        self.t: A = None
        self.txt = txt

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

n = A("n")
m = B("m")
b = C("b")
e = D("e")
a = B("a")
g = A("g")
l = A("l")
d = C("d")
j = C("j")
k = A("k")

n.q = l
n.t = e
n.w = m
m.x = g
b.v = j
b.t = n
e.w = n
a.x = l
g.q = l
g.t = e
g.w = m
l.q = g
l.t = e
l.w = a
d.v = j
d.t = l
j.v = d
j.t = k
k.q = g
k.t = e
k.w = m
assert g.q.w.x.w.x.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: D = None
        self.w: B = 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.v: C = None
        self.t: A = None
        self.txt = txt

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

n = A("n")
m = B("m")
b = C("b")
e = D("e")
a = B("a")
g = A("g")
l = A("l")
d = C("d")
j = C("j")
k = A("k")

n.q = l
n.t = e
n.w = m
m.x = g
b.v = j
b.t = n
e.w = n
a.x = l
g.q = l
g.t = e
g.w = m
l.q = g
l.t = e
l.w = a
d.v = j
d.t = l
j.v = d
j.t = k
k.q = g
k.t = e
k.w = m
assert g.q.w.x.w.x.q.q.q.txt == "g"