class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: F = None
        self.w: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: A = None
        self.s: D = None
        self.p: B = None
        self.o: A = None
        self.txt = txt

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

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

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

a.v = m
a.x = d
a.w = c
m.t = k
m.q = a
i.u = a
i.x = a
i.q = a
i.z = a
i.w = n
b.w = c
h.x = a
h.w = a
h.o = a
h.s = b
h.p = m
d.z = b
d.q = b
d.w = n
n.u = h
n.z = d
c.u = a
c.x = a
c.q = a
c.z = a
c.w = n
k.t = m
k.q = a
assert h.p.t.t.q.v.q.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: F = None
        self.w: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: A = None
        self.s: D = None
        self.p: B = None
        self.o: A = None
        self.txt = txt

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

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

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

a.v = m
a.x = d
a.w = c
m.t = k
m.q = a
i.u = a
i.x = a
i.q = a
i.z = a
i.w = n
b.w = c
h.x = a
h.w = a
h.o = a
h.s = b
h.p = m
d.z = b
d.q = b
d.w = n
n.u = h
n.z = d
c.u = a
c.x = a
c.q = a
c.z = a
c.w = n
k.t = m
k.q = a
assert h.p.t.t.q.v.q.w.q.txt == "a"