class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.q: B = None
        self.p: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: A = None
        self.q: B = None
        self.z: C = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: A = None
        self.q: B = None
        self.z: C = None
        self.p: D = None
        self.txt = txt

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

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

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