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

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: E = None
        self.q: C = None
        self.w: E = None
        self.y: C = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: E = None
        self.q: C = None
        self.w: E = None
        self.y: C = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

m.o = i
b.q = a
j.u = b
j.x = d
j.w = d
j.q = c
j.y = c
h.z = c
h.s = b
h.r = d
d.q = b
i.x = k
i.t = h
i.v = b
i.o = d
a.t = d
k.o = i
c.u = b
c.x = d
c.w = d
c.q = j
c.y = j
assert m.o.o.q.q.t.q.q.txt == "a"