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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: A = None
        self.x: A = None
        self.v: F = None
        self.txt = txt

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

a.q = n
k.v = g
k.q = a
k.y = i
k.r = l
k.w = l
f.u = b
f.x = m
f.o = g
m.u = k
m.o = a
l.w = k
l.y = m
g.u = m
g.z = f
g.t = c
c.w = a
c.y = a
c.x = a
c.v = g
n.u = k
n.x = m
n.o = g
b.v = g
b.q = a
b.y = c
b.r = l
b.w = l
i.w = a
i.y = a
i.x = a
i.v = g
assert f.x.u.y.v.z.o.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: A = None
        self.x: A = None
        self.v: F = None
        self.txt = txt

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

a.q = n
k.v = g
k.q = a
k.y = i
k.r = l
k.w = l
f.u = b
f.x = m
f.o = g
m.u = k
m.o = a
l.w = k
l.y = m
g.u = m
g.z = f
g.t = c
c.w = a
c.y = a
c.x = a
c.v = g
n.u = k
n.x = m
n.o = g
b.v = g
b.q = a
b.y = c
b.r = l
b.w = l
i.w = a
i.y = a
i.x = a
i.v = g
assert f.x.u.y.v.z.o.u.o.txt == "a"