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

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: B = None
        self.u: C = None
        self.v: F = None
        self.p: E = None
        self.w: E = None
        self.s: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: D = None
        self.y: E = None
        self.t: B = None
        self.p: A = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: B = None
        self.u: C = None
        self.v: F = None
        self.p: E = None
        self.w: E = None
        self.s: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: D = None
        self.y: E = None
        self.t: B = None
        self.p: A = None
        self.txt = txt

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

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

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