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

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

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: B = None
        self.o: F = None
        self.z: F = None
        self.w: A = None
        self.txt = txt

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

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

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

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

d.w = c
d.p = a
h.u = g
h.q = g
h.z = m
m.u = h
a.x = d
a.w = d
a.u = f
a.o = c
a.z = c
j.z = g
c.x = i
c.q = j
i.p = d
i.z = d
g.z = j
f.u = g
f.z = m
f.q = j
assert i.z.w.q.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.p: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: B = None
        self.o: F = None
        self.z: F = None
        self.w: A = None
        self.txt = txt

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

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

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

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

d.w = c
d.p = a
h.u = g
h.q = g
h.z = m
m.u = h
a.x = d
a.w = d
a.u = f
a.o = c
a.z = c
j.z = g
c.x = i
c.q = j
i.p = d
i.z = d
g.z = j
f.u = g
f.z = m
f.q = j
assert i.z.w.q.z.z.txt == "j"