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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.r: E = None
        self.o: A = None
        self.x: A = None
        self.p: A = None
        self.q: E = None
        self.z: A = 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.r: A = None
        self.y: F = None
        self.q: F = None
        self.v: G = None
        self.t: G = None
        self.z: B = None
        self.x: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.q: G = None
        self.u: E = None
        self.txt = txt

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

b = A("b")
i = B("i")
a = C("a")
f = D("f")
d = E("d")
c = F("c")
n = G("n")

b.p = c
b.q = i
b.r = a
b.s = f
i.u = d
i.r = d
i.q = d
i.o = b
i.x = b
i.p = b
i.z = b
a.s = f
f.r = b
f.x = b
f.y = c
f.q = c
f.v = n
f.t = n
f.z = i
d.y = b
d.q = a
d.z = a
d.u = a
d.w = c
d.v = i
c.z = f
c.q = n
c.u = d
n.t = a
n.u = d
assert n.u.y.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: B = None
        self.r: C = None
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.r: E = None
        self.o: A = None
        self.x: A = None
        self.p: A = None
        self.q: E = None
        self.z: A = 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.r: A = None
        self.y: F = None
        self.q: F = None
        self.v: G = None
        self.t: G = None
        self.z: B = None
        self.x: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.q: G = None
        self.u: E = None
        self.txt = txt

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

b = A("b")
i = B("i")
a = C("a")
f = D("f")
d = E("d")
c = F("c")
n = G("n")

b.p = c
b.q = i
b.r = a
b.s = f
i.u = d
i.r = d
i.q = d
i.o = b
i.x = b
i.p = b
i.z = b
a.s = f
f.r = b
f.x = b
f.y = c
f.q = c
f.v = n
f.t = n
f.z = i
d.y = b
d.q = a
d.z = a
d.u = a
d.w = c
d.v = i
c.z = f
c.q = n
c.u = d
n.t = a
n.u = d
assert n.u.y.q.z.txt == "b"