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

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

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: A = None
        self.x: B = None
        self.v: G = None
        self.s: F = None
        self.txt = txt

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

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

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

g = A("g")
a = B("a")
b = C("b")
k = D("k")
h = E("h")
m = F("m")
i = G("i")
e = B("e")

g.o = k
a.v = h
b.t = i
b.q = k
k.z = m
k.s = m
k.y = g
k.x = a
k.v = i
h.z = g
h.q = g
h.x = b
h.w = b
h.t = m
h.s = i
m.u = i
m.s = i
m.v = e
m.r = k
m.p = k
m.o = k
i.z = k
i.q = m
i.o = m
e.v = h
assert g.o.x.v.w.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: A = None
        self.x: B = None
        self.v: G = None
        self.s: F = None
        self.txt = txt

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

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

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

g = A("g")
a = B("a")
b = C("b")
k = D("k")
h = E("h")
m = F("m")
i = G("i")
e = B("e")

g.o = k
a.v = h
b.t = i
b.q = k
k.z = m
k.s = m
k.y = g
k.x = a
k.v = i
h.z = g
h.q = g
h.x = b
h.w = b
h.t = m
h.s = i
m.u = i
m.s = i
m.v = e
m.r = k
m.p = k
m.o = k
i.z = k
i.q = m
i.o = m
e.v = h
assert g.o.x.v.w.q.y.txt == "g"