class A:
    def __init__(self, txt: str):
        self.y: G = None
        self.v: F = None
        self.s: F = None
        self.q: C = None
        self.u: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: G = None
        self.o: G = None
        self.w: G = None
        self.u: A = None
        self.p: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: G = None
        self.o: G = None
        self.w: G = None
        self.u: A = None
        self.p: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

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