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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.x: C = None
        self.v: B = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.y: A = None
        self.o: G = None
        self.txt = txt

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

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

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

a.t = j
a.q = k
i.z = a
i.x = j
i.v = m
f.p = m
f.v = g
f.w = g
f.t = n
f.y = k
f.o = k
g.w = m
d.x = i
d.y = a
d.o = n
k.u = m
k.p = n
k.v = n
k.x = d
k.o = d
k.w = f
n.p = f
n.u = g
j.p = m
j.v = g
j.w = g
j.t = n
j.y = k
j.o = k
m.z = a
m.x = f
m.v = i
assert f.t.u.w.z.q.w.v.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.x: C = None
        self.v: B = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.y: A = None
        self.o: G = None
        self.txt = txt

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

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

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

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