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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: D = None
        self.w: E = None
        self.u: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: B = None
        self.r: F = None
        self.w: A = None
        self.s: F = None
        self.p: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: F = None
        self.x: D = None
        self.z: B = None
        self.p: D = None
        self.o: C = None
        self.txt = txt

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

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

k = A("k")
d = B("d")
c = C("c")
n = D("n")
e = E("e")
j = F("j")
h = G("h")

k.z = h
d.s = k
d.y = n
d.w = e
d.u = c
c.s = n
n.u = k
n.w = k
n.y = d
n.r = j
n.s = j
n.p = e
e.y = d
e.z = d
e.s = j
e.x = n
e.p = n
e.o = c
j.w = k
h.y = c
h.r = e
assert h.r.o.s.u.z.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: D = None
        self.w: E = None
        self.u: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: B = None
        self.r: F = None
        self.w: A = None
        self.s: F = None
        self.p: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: F = None
        self.x: D = None
        self.z: B = None
        self.p: D = None
        self.o: C = None
        self.txt = txt

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

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

k = A("k")
d = B("d")
c = C("c")
n = D("n")
e = E("e")
j = F("j")
h = G("h")

k.z = h
d.s = k
d.y = n
d.w = e
d.u = c
c.s = n
n.u = k
n.w = k
n.y = d
n.r = j
n.s = j
n.p = e
e.y = d
e.z = d
e.s = j
e.x = n
e.p = n
e.o = c
j.w = k
h.y = c
h.r = e
assert h.r.o.s.u.z.y.s.txt == "n"