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

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

class C:
    def __init__(self, txt: str):
        self.x: H = None
        self.y: H = None
        self.z: F = None
        self.s: H = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: C = None
        self.r: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: B = None
        self.y: G = None
        self.txt = txt

d = A("d")
m = B("m")
n = C("n")
i = D("i")
f = E("f")
e = F("e")
k = G("k")
a = H("a")

d.x = n
d.s = i
d.u = i
d.q = i
d.t = e
m.x = i
n.x = a
n.y = a
n.s = a
n.z = e
i.o = f
i.q = m
i.x = k
f.y = a
e.p = i
e.x = f
k.p = i
k.r = i
k.s = n
a.p = m
a.x = m
a.y = k
assert f.y.x.x.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: D = None
        self.u: D = None
        self.q: D = None
        self.t: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: H = None
        self.y: H = None
        self.z: F = None
        self.s: H = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: C = None
        self.r: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: B = None
        self.y: G = None
        self.txt = txt

d = A("d")
m = B("m")
n = C("n")
i = D("i")
f = E("f")
e = F("e")
k = G("k")
a = H("a")

d.x = n
d.s = i
d.u = i
d.q = i
d.t = e
m.x = i
n.x = a
n.y = a
n.s = a
n.z = e
i.o = f
i.q = m
i.x = k
f.y = a
e.p = i
e.x = f
k.p = i
k.r = i
k.s = n
a.p = m
a.x = m
a.y = k
assert f.y.x.x.q.x.txt == "i"