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

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: D = None
        self.q: C = None
        self.z: F = None
        self.t: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: B = None
        self.q: C = None
        self.w: E = None
        self.t: D = None
        self.x: D = None
        self.r: C = None
        self.txt = txt

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

m = A("m")
h = B("h")
d = C("d")
a = D("a")
f = E("f")
k = F("k")
j = G("j")
g = C("g")
i = G("i")
c = A("c")

m.o = c
m.q = i
h.v = m
h.x = a
h.t = a
h.q = d
h.z = k
d.z = f
a.u = d
a.r = d
f.o = a
f.p = i
k.o = f
k.w = f
k.p = h
k.q = g
k.t = a
k.x = a
k.r = d
j.v = c
g.z = f
i.v = c
c.o = m
c.q = i
assert g.z.p.v.q.v.q.v.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.q: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: D = None
        self.q: C = None
        self.z: F = None
        self.t: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: B = None
        self.q: C = None
        self.w: E = None
        self.t: D = None
        self.x: D = None
        self.r: C = None
        self.txt = txt

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

m = A("m")
h = B("h")
d = C("d")
a = D("a")
f = E("f")
k = F("k")
j = G("j")
g = C("g")
i = G("i")
c = A("c")

m.o = c
m.q = i
h.v = m
h.x = a
h.t = a
h.q = d
h.z = k
d.z = f
a.u = d
a.r = d
f.o = a
f.p = i
k.o = f
k.w = f
k.p = h
k.q = g
k.t = a
k.x = a
k.r = d
j.v = c
g.z = f
i.v = c
c.o = m
c.q = i
assert g.z.p.v.q.v.q.v.q.v.txt == "c"