class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.v: G = None
        self.o: G = None
        self.q: A = None
        self.w: A = None
        self.p: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: F = None
        self.z: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: G = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.v: G = None
        self.o: G = None
        self.q: A = None
        self.w: A = None
        self.p: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: F = None
        self.z: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: G = None
        self.txt = txt

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

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

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

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

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