class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: G = None
        self.r: E = None
        self.w: E = None
        self.o: B = None
        self.v: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: D = None
        self.o: F = None
        self.t: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.v: C = None
        self.o: A = None
        self.p: D = None
        self.t: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: F = None
        self.s: F = None
        self.o: B = None
        self.txt = txt

g = A("g")
a = B("a")
d = C("d")
k = D("k")
c = E("c")
h = F("h")
j = G("j")
m = B("m")

g.p = a
g.w = c
a.w = g
a.q = j
d.q = c
d.r = c
d.w = c
d.v = c
d.s = j
d.o = a
k.s = g
c.u = g
c.q = k
c.o = h
c.t = h
h.z = k
h.p = k
h.v = d
h.o = g
h.t = j
j.u = h
j.s = h
j.o = a
m.w = g
m.q = j
assert m.q.s.p.s.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: G = None
        self.r: E = None
        self.w: E = None
        self.o: B = None
        self.v: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: D = None
        self.o: F = None
        self.t: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.v: C = None
        self.o: A = None
        self.p: D = None
        self.t: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: F = None
        self.s: F = None
        self.o: B = None
        self.txt = txt

g = A("g")
a = B("a")
d = C("d")
k = D("k")
c = E("c")
h = F("h")
j = G("j")
m = B("m")

g.p = a
g.w = c
a.w = g
a.q = j
d.q = c
d.r = c
d.w = c
d.v = c
d.s = j
d.o = a
k.s = g
c.u = g
c.q = k
c.o = h
c.t = h
h.z = k
h.p = k
h.v = d
h.o = g
h.t = j
j.u = h
j.s = h
j.o = a
m.w = g
m.q = j
assert m.q.s.p.s.p.w.txt == "g"