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

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.v: F = None
        self.t: E = None
        self.p: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.p: D = None
        self.z: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: G = None
        self.o: C = None
        self.s: F = None
        self.r: A = None
        self.w: G = None
        self.q: D = None
        self.u: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: D = None
        self.o: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: G = None
        self.x: A = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.v: F = None
        self.t: E = None
        self.p: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.p: D = None
        self.z: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: G = None
        self.o: C = None
        self.s: F = None
        self.r: A = None
        self.w: G = None
        self.q: D = None
        self.u: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: D = None
        self.o: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: G = None
        self.x: A = None
        self.txt = txt

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

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