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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: E = None
        self.p: B = None
        self.z: D = None
        self.t: B = None
        self.y: G = None
        self.o: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.r: E = None
        self.txt = txt

h = A("h")
k = B("k")
a = C("a")
n = D("n")
e = E("e")
b = F("b")
g = G("g")

h.z = a
h.q = b
k.q = b
k.y = e
k.w = a
a.z = k
n.r = h
n.u = e
n.s = e
e.y = a
e.t = a
e.s = b
e.p = g
b.u = k
b.p = k
b.t = k
b.w = e
b.z = n
b.y = g
b.o = h
g.t = b
g.r = e
assert b.p.y.s.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: E = None
        self.p: B = None
        self.z: D = None
        self.t: B = None
        self.y: G = None
        self.o: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.r: E = None
        self.txt = txt

h = A("h")
k = B("k")
a = C("a")
n = D("n")
e = E("e")
b = F("b")
g = G("g")

h.z = a
h.q = b
k.q = b
k.y = e
k.w = a
a.z = k
n.r = h
n.u = e
n.s = e
e.y = a
e.t = a
e.s = b
e.p = g
b.u = k
b.p = k
b.t = k
b.w = e
b.z = n
b.y = g
b.o = h
g.t = b
g.r = e
assert b.p.y.s.o.z.txt == "a"