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

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.r: D = None
        self.q: G = None
        self.o: D = None
        self.p: E = None
        self.x: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.t: D = None
        self.x: B = None
        self.y: A = None
        self.z: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: E = None
        self.w: A = None
        self.y: C = None
        self.u: E = None
        self.v: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.r: D = None
        self.q: G = None
        self.o: D = None
        self.p: E = None
        self.x: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.t: D = None
        self.x: B = None
        self.y: A = None
        self.z: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: E = None
        self.w: A = None
        self.y: C = None
        self.u: E = None
        self.v: C = None
        self.txt = txt

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

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