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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: E = None
        self.s: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: G = None
        self.o: B = None
        self.w: E = None
        self.u: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.q: D = None
        self.x: C = None
        self.v: D = None
        self.t: E = None
        self.p: A = None
        self.u: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: D = None
        self.x: A = None
        self.p: E = None
        self.t: F = None
        self.txt = txt

f = A("f")
h = B("h")
e = C("e")
n = D("n")
l = E("l")
g = F("g")
k = G("k")
a = E("a")
m = E("m")

f.s = n
h.o = n
h.p = l
h.s = m
e.w = f
n.q = k
n.o = h
n.u = h
n.w = a
l.w = g
g.w = a
g.q = n
g.v = n
g.x = e
g.t = l
g.p = f
g.u = k
k.u = l
k.p = l
k.y = n
k.x = f
k.t = g
a.w = g
m.w = g
assert a.w.v.w.w.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: E = None
        self.s: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: G = None
        self.o: B = None
        self.w: E = None
        self.u: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.q: D = None
        self.x: C = None
        self.v: D = None
        self.t: E = None
        self.p: A = None
        self.u: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: D = None
        self.x: A = None
        self.p: E = None
        self.t: F = None
        self.txt = txt

f = A("f")
h = B("h")
e = C("e")
n = D("n")
l = E("l")
g = F("g")
k = G("k")
a = E("a")
m = E("m")

f.s = n
h.o = n
h.p = l
h.s = m
e.w = f
n.q = k
n.o = h
n.u = h
n.w = a
l.w = g
g.w = a
g.q = n
g.v = n
g.x = e
g.t = l
g.p = f
g.u = k
k.u = l
k.p = l
k.y = n
k.x = f
k.t = g
a.w = g
m.w = g
assert a.w.v.w.w.p.s.txt == "n"