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

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.y: G = None
        self.s: G = None
        self.x: E = None
        self.r: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: B = None
        self.w: C = None
        self.v: C = None
        self.z: D = None
        self.o: B = None
        self.r: A = None
        self.txt = txt

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

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

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

g.y = a
f.s = j
f.u = i
f.q = h
f.v = h
f.z = g
n.s = f
n.y = j
n.o = h
n.x = i
j.z = g
j.y = i
j.s = i
j.r = i
j.x = a
a.p = n
a.w = n
a.v = n
a.s = f
a.o = f
a.z = j
a.r = g
h.y = i
h.v = a
h.x = n
i.w = a
i.v = n
i.p = n
i.o = j
i.x = j
i.r = j
assert f.s.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.y: G = None
        self.s: G = None
        self.x: E = None
        self.r: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: B = None
        self.w: C = None
        self.v: C = None
        self.z: D = None
        self.o: B = None
        self.r: A = None
        self.txt = txt

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

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

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

g.y = a
f.s = j
f.u = i
f.q = h
f.v = h
f.z = g
n.s = f
n.y = j
n.o = h
n.x = i
j.z = g
j.y = i
j.s = i
j.r = i
j.x = a
a.p = n
a.w = n
a.v = n
a.s = f
a.o = f
a.z = j
a.r = g
h.y = i
h.v = a
h.x = n
i.w = a
i.v = n
i.p = n
i.o = j
i.x = j
i.r = j
assert f.s.x.r.txt == "g"