class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.q: E = None
        self.o: F = None
        self.z: G = None
        self.x: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.v: B = None
        self.q: B = None
        self.r: D = None
        self.w: D = None
        self.o: G = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.v: B = None
        self.q: B = None
        self.r: D = None
        self.w: D = None
        self.o: G = None
        self.txt = txt

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

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

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