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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: F = None
        self.o: A = None
        self.s: A = None
        self.q: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: C = None
        self.p: D = None
        self.q: A = None
        self.o: C = None
        self.z: B = None
        self.x: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.y: C = None
        self.r: C = None
        self.p: E = None
        self.o: E = None
        self.z: A = None
        self.s: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: A = None
        self.u: B = None
        self.w: E = None
        self.o: A = None
        self.s: E = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: F = None
        self.o: A = None
        self.s: A = None
        self.q: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: C = None
        self.p: D = None
        self.q: A = None
        self.o: C = None
        self.z: B = None
        self.x: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.y: C = None
        self.r: C = None
        self.p: E = None
        self.o: E = None
        self.z: A = None
        self.s: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: A = None
        self.u: B = None
        self.w: E = None
        self.o: A = None
        self.s: E = None
        self.txt = txt

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

a.q = j
c.t = m
b.r = c
b.t = e
b.q = e
b.o = j
b.s = a
m.r = e
k.r = c
k.z = c
k.x = c
k.y = b
k.o = b
k.p = m
k.q = j
e.q = g
e.o = g
e.y = b
e.r = b
e.p = k
e.z = j
e.s = c
n.r = m
n.y = a
n.u = c
n.w = k
n.o = j
n.s = g
j.q = a
g.r = c
g.z = c
g.x = c
g.y = b
g.o = b
g.p = m
g.q = a
assert c.t.r.o.txt == "g"