class A:
    def __init__(self, txt: str):
        self.u: H = None
        self.x: H = None
        self.s: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: H = None
        self.y: E = None
        self.r: G = None
        self.p: B = None
        self.u: H = None
        self.q: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: H = None
        self.x: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: D = None
        self.w: B = None
        self.s: F = None
        self.txt = txt

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

e = A("e")
g = B("g")
c = C("c")
f = D("f")
b = E("b")
j = F("j")
n = G("n")
k = H("k")
d = A("d")

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

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

class C:
    def __init__(self, txt: str):
        self.v: H = None
        self.y: E = None
        self.r: G = None
        self.p: B = None
        self.u: H = None
        self.q: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: H = None
        self.x: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: D = None
        self.w: B = None
        self.s: F = None
        self.txt = txt

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

e = A("e")
g = B("g")
c = C("c")
f = D("f")
b = E("b")
j = F("j")
n = G("n")
k = H("k")
d = A("d")

e.u = k
e.x = k
e.s = f
g.p = j
g.q = f
g.w = n
c.v = k
c.u = k
c.y = b
c.r = n
c.q = n
c.p = g
f.z = k
f.x = c
b.q = g
b.v = n
j.q = n
n.p = g
n.w = g
n.y = f
n.s = j
k.t = b
d.u = k
d.x = k
d.s = f
assert e.u.t.q.txt == "g"