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

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.z: F = None
        self.s: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: C = None
        self.x: F = None
        self.u: C = None
        self.r: D = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.w: G = None
        self.txt = txt

c = A("c")
i = B("i")
e = C("e")
f = D("f")
m = E("m")
a = F("a")
d = G("d")
b = H("b")
j = F("j")

c.q = j
c.z = i
i.y = j
i.z = j
i.s = f
e.z = c
f.p = m
f.w = a
m.q = c
m.y = e
m.u = e
m.x = a
m.r = f
a.t = e
a.z = f
d.r = m
d.q = b
d.p = j
b.w = d
j.t = e
j.z = f
assert f.w.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.z: F = None
        self.s: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: C = None
        self.x: F = None
        self.u: C = None
        self.r: D = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.w: G = None
        self.txt = txt

c = A("c")
i = B("i")
e = C("e")
f = D("f")
m = E("m")
a = F("a")
d = G("d")
b = H("b")
j = F("j")

c.q = j
c.z = i
i.y = j
i.z = j
i.s = f
e.z = c
f.p = m
f.w = a
m.q = c
m.y = e
m.u = e
m.x = a
m.r = f
a.t = e
a.z = f
d.r = m
d.q = b
d.p = j
b.w = d
j.t = e
j.z = f
assert f.w.t.z.txt == "c"