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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: A = None
        self.y: C = None
        self.v: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: G = None
        self.s: G = None
        self.y: G = None
        self.q: C = None
        self.r: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

c.q = n
c.r = b
c.s = f
c.p = k
g.o = f
g.y = f
g.t = n
g.v = a
f.r = m
m.q = a
b.t = k
b.s = k
b.y = k
b.q = f
b.r = m
a.t = g
k.y = f
k.s = b
n.q = c
n.r = b
n.s = f
n.p = k
assert n.r.t.y.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: E = None
        self.s: C = None
        self.p: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: A = None
        self.y: C = None
        self.v: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: G = None
        self.s: G = None
        self.y: G = None
        self.q: C = None
        self.r: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

c.q = n
c.r = b
c.s = f
c.p = k
g.o = f
g.y = f
g.t = n
g.v = a
f.r = m
m.q = a
b.t = k
b.s = k
b.y = k
b.q = f
b.r = m
a.t = g
k.y = f
k.s = b
n.q = c
n.r = b
n.s = f
n.p = k
assert n.r.t.y.r.q.txt == "a"