class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: G = None
        self.p: G = None
        self.q: C = None
        self.y: D = None
        self.r: 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: F = None
        self.txt = txt

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

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

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

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

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

m.o = a
m.y = a
m.r = a
m.s = b
m.p = b
m.q = i
k.v = c
i.t = g
a.w = b
a.q = c
c.o = a
g.t = i
g.r = a
g.p = a
b.s = m
b.y = m
b.t = m
b.u = i
b.x = c
b.p = g
assert m.q.t.p.q.o.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: G = None
        self.p: G = None
        self.q: C = None
        self.y: D = None
        self.r: 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: F = None
        self.txt = txt

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

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

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

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

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

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