class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: D = None
        self.x: E = None
        self.y: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: B = None
        self.z: B = None
        self.o: A = None
        self.t: B = None
        self.v: E = None
        self.txt = txt

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

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

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

j = A("j")
e = B("e")
d = C("d")
g = D("g")
n = E("n")
b = F("b")
i = G("i")

j.q = n
j.x = n
j.z = g
j.y = d
e.t = b
e.r = b
e.x = j
e.p = g
e.o = g
e.w = d
d.r = n
d.p = n
d.q = e
d.y = i
d.o = i
g.x = j
g.o = j
g.u = e
g.z = e
g.t = e
g.v = n
n.o = d
n.z = b
n.x = e
b.s = j
i.x = j
assert b.s.q.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: D = None
        self.x: E = None
        self.y: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: B = None
        self.z: B = None
        self.o: A = None
        self.t: B = None
        self.v: E = None
        self.txt = txt

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

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

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

j = A("j")
e = B("e")
d = C("d")
g = D("g")
n = E("n")
b = F("b")
i = G("i")

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