class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: D = None
        self.r: B = None
        self.q: D = None
        self.z: D = None
        self.t: D = None
        self.y: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: B = None
        self.q: G = None
        self.v: E = None
        self.y: A = None
        self.o: B = None
        self.txt = txt

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

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

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

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

b = A("b")
m = B("m")
h = C("h")
c = D("c")
f = E("f")
e = F("e")
g = G("g")

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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: B = None
        self.q: G = None
        self.v: E = None
        self.y: A = None
        self.o: B = None
        self.txt = txt

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

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

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

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

b = A("b")
m = B("m")
h = C("h")
c = D("c")
f = E("f")
e = F("e")
g = G("g")

b.x = c
b.s = c
b.q = c
b.z = c
b.t = c
b.y = c
b.r = m
m.u = f
h.p = m
h.t = m
h.o = m
h.q = g
h.v = f
h.y = b
c.q = g
f.r = g
f.q = g
e.x = b
e.t = g
e.u = c
e.v = h
g.z = h
assert g.z.y.r.u.q.z.txt == "h"