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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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