class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.z: B = None
        self.r: C = None
        self.x: B = None
        self.u: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: D = None
        self.y: A = None
        self.x: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: A = None
        self.y: A = None
        self.w: F = None
        self.u: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: G = None
        self.y: B = None
        self.x: F = None
        self.txt = txt

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

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

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

h.q = m
h.z = g
h.x = g
h.r = b
h.u = d
g.u = b
g.z = f
g.y = h
g.x = h
b.s = g
b.z = h
b.y = h
b.w = m
b.u = m
j.w = d
j.x = d
j.q = h
i.p = g
i.y = g
i.z = d
i.x = m
m.t = d
m.q = g
m.p = f
d.z = i
f.w = d
f.x = d
f.q = h
assert m.q.y.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.z: B = None
        self.r: C = None
        self.x: B = None
        self.u: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: D = None
        self.y: A = None
        self.x: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: A = None
        self.y: A = None
        self.w: F = None
        self.u: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: G = None
        self.y: B = None
        self.x: F = None
        self.txt = txt

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

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

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

h.q = m
h.z = g
h.x = g
h.r = b
h.u = d
g.u = b
g.z = f
g.y = h
g.x = h
b.s = g
b.z = h
b.y = h
b.w = m
b.u = m
j.w = d
j.x = d
j.q = h
i.p = g
i.y = g
i.z = d
i.x = m
m.t = d
m.q = g
m.p = f
d.z = i
f.w = d
f.x = d
f.q = h
assert m.q.y.q.q.txt == "g"