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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: C = None
        self.r: A = None
        self.o: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.w: G = None
        self.o: A = None
        self.y: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: G = None
        self.o: C = None
        self.p: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.u: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: C = None
        self.r: A = None
        self.o: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.w: G = None
        self.o: A = None
        self.y: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: G = None
        self.o: C = None
        self.p: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.u: D = None
        self.txt = txt

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

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