class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: D = None
        self.r: G = None
        self.u: D = None
        self.txt = txt

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

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

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

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

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

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

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

h.t = a
h.s = f
h.u = f
h.r = j
k.r = h
k.q = a
k.t = d
k.u = j
k.w = f
l.t = d
l.u = d
f.p = l
f.q = a
f.u = a
f.s = a
f.t = k
f.w = k
f.z = k
a.t = f
d.t = f
j.t = f
j.v = d
j.x = a
assert h.s.w.w.s.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: D = None
        self.r: G = None
        self.u: D = None
        self.txt = txt

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

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

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

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

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

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

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

h.t = a
h.s = f
h.u = f
h.r = j
k.r = h
k.q = a
k.t = d
k.u = j
k.w = f
l.t = d
l.u = d
f.p = l
f.q = a
f.u = a
f.s = a
f.t = k
f.w = k
f.z = k
a.t = f
d.t = f
j.t = f
j.v = d
j.x = a
assert h.s.w.w.s.t.s.txt == "a"