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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: E = None
        self.y: B = None
        self.t: B = None
        self.z: B = None
        self.txt = txt

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

e.w = d
e.x = d
e.q = a
g.z = j
g.q = a
h.z = c
h.u = m
b.y = e
c.t = a
j.u = b
j.t = c
a.u = b
a.v = c
a.y = g
a.t = g
a.z = g
m.z = c
m.u = h
d.w = e
d.x = e
d.q = a
assert j.t.t.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: A = None
        self.q: G = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: E = None
        self.y: B = None
        self.t: B = None
        self.z: B = None
        self.txt = txt

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

e.w = d
e.x = d
e.q = a
g.z = j
g.q = a
h.z = c
h.u = m
b.y = e
c.t = a
j.u = b
j.t = c
a.u = b
a.v = c
a.y = g
a.t = g
a.z = g
m.z = c
m.u = h
d.w = e
d.x = e
d.q = a
assert j.t.t.v.t.txt == "a"