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

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

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.x: A = None
        self.y: B = None
        self.z: A = None
        self.txt = txt

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

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

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

g = A("g")
e = B("e")
l = C("l")
h = D("h")
f = E("f")
n = F("n")
j = G("j")
k = E("k")
d = A("d")

g.x = n
g.q = n
g.y = e
g.t = d
e.q = n
l.v = j
l.z = h
l.w = k
h.w = l
h.x = d
h.z = d
h.y = e
f.r = j
n.p = h
n.t = f
j.p = d
j.w = l
j.u = k
k.r = j
d.x = n
d.q = n
d.y = e
d.t = g
assert g.q.p.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.q: F = None
        self.y: B = None
        self.t: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.x: A = None
        self.y: B = None
        self.z: A = None
        self.txt = txt

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

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

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

g = A("g")
e = B("e")
l = C("l")
h = D("h")
f = E("f")
n = F("n")
j = G("j")
k = E("k")
d = A("d")

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