class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: B = None
        self.r: B = None
        self.z: G = None
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: F = None
        self.q: E = None
        self.r: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.y: F = None
        self.z: A = None
        self.txt = txt

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

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

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

m.o = n
m.t = b
m.r = b
m.z = e
m.p = g
b.y = k
g.u = l
g.q = l
g.r = l
g.y = k
n.y = g
l.v = k
l.y = k
l.z = m
k.u = g
k.s = e
e.w = c
c.y = g
i.y = g
assert g.q.z.t.y.s.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: B = None
        self.r: B = None
        self.z: G = None
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: F = None
        self.q: E = None
        self.r: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.y: F = None
        self.z: A = None
        self.txt = txt

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

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

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

m.o = n
m.t = b
m.r = b
m.z = e
m.p = g
b.y = k
g.u = l
g.q = l
g.r = l
g.y = k
n.y = g
l.v = k
l.y = k
l.z = m
k.u = g
k.s = e
e.w = c
c.y = g
i.y = g
assert g.q.z.t.y.s.w.y.txt == "g"