class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.w: G = None
        self.q: E = None
        self.y: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: G = None
        self.q: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: E = None
        self.q: E = None
        self.w: B = None
        self.x: B = None
        self.u: F = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: G = None
        self.q: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: E = None
        self.q: E = None
        self.w: B = None
        self.x: B = None
        self.u: F = None
        self.txt = txt

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

j.p = a
j.y = a
j.w = e
j.q = g
n.r = e
n.s = d
n.y = d
n.p = g
n.w = f
n.o = f
a.o = j
k.u = j
k.q = j
k.y = e
g.z = j
g.w = e
f.s = g
f.z = n
f.r = j
e.y = g
e.q = g
e.w = d
e.x = n
e.u = f
d.r = e
d.s = n
d.y = n
d.p = g
d.w = f
d.o = f
assert a.o.q.z.y.o.w.q.txt == "g"