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

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

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

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

m = A("m")
j = B("j")
g = C("g")
k = D("k")
f = D("f")
h = A("h")
n = B("n")
i = D("i")
e = A("e")

m.q = e
m.x = h
m.v = n
m.t = n
j.z = g
j.w = m
j.q = n
g.s = m
k.q = g
k.x = g
k.p = g
k.v = f
f.q = g
f.x = g
f.p = g
f.v = k
h.q = e
h.x = e
h.v = j
h.t = j
n.z = g
n.w = m
n.q = j
i.q = g
i.x = g
i.p = g
i.v = k
e.q = m
e.x = h
e.v = n
e.t = j
assert g.s.q.t.z.s.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.x: A = None
        self.v: B = None
        self.t: B = None
        self.txt = txt

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

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

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

m = A("m")
j = B("j")
g = C("g")
k = D("k")
f = D("f")
h = A("h")
n = B("n")
i = D("i")
e = A("e")

m.q = e
m.x = h
m.v = n
m.t = n
j.z = g
j.w = m
j.q = n
g.s = m
k.q = g
k.x = g
k.p = g
k.v = f
f.q = g
f.x = g
f.p = g
f.v = k
h.q = e
h.x = e
h.v = j
h.t = j
n.z = g
n.w = m
n.q = j
i.q = g
i.x = g
i.p = g
i.v = k
e.q = m
e.x = h
e.v = n
e.t = j
assert g.s.q.t.z.s.x.x.txt == "e"