class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: D = None
        self.q: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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

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

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

n.w = g
n.q = g
n.x = i
m.p = e
m.q = e
e.y = f
e.v = j
e.q = m
i.o = g
j.y = g
j.w = e
g.y = i
g.v = f
g.u = e
f.z = j
f.y = i
f.q = n
f.w = n
f.r = n
f.p = g
f.v = e
assert e.q.p.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: D = None
        self.q: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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

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

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

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