class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.v: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: G = None
        self.w: F = None
        self.r: G = None
        self.p: A = None
        self.v: G = None
        self.u: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: A = None
        self.u: A = None
        self.r: F = None
        self.o: A = None
        self.v: B = None
        self.y: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: E = None
        self.v: B = None
        self.y: A = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: G = None
        self.w: F = None
        self.r: G = None
        self.p: A = None
        self.v: G = None
        self.u: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: A = None
        self.u: A = None
        self.r: F = None
        self.o: A = None
        self.v: B = None
        self.y: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: E = None
        self.v: B = None
        self.y: A = None
        self.txt = txt

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

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

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