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

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

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

m.o = j
m.t = k
k.z = a
k.w = n
f.o = j
f.p = a
f.x = i
n.q = f
i.s = f
i.z = a
i.w = j
j.z = k
a.z = f
a.x = m
assert f.x.s.o.z.w.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.t: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

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

m.o = j
m.t = k
k.z = a
k.w = n
f.o = j
f.p = a
f.x = i
n.q = f
i.s = f
i.z = a
i.w = j
j.z = k
a.z = f
a.x = m
assert f.x.s.o.z.w.q.p.txt == "a"