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

class B:
    def __init__(self, txt: str):
        self.s: H = None
        self.o: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: H = None
        self.t: A = None
        self.r: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: G = None
        self.y: F = None
        self.u: H = None
        self.o: A = None
        self.z: C = None
        self.p: H = None
        self.x: E = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: D = None
        self.txt = txt

i = A("i")
a = B("a")
l = C("l")
f = D("f")
h = E("h")
b = F("b")
d = G("d")
m = H("m")

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

class B:
    def __init__(self, txt: str):
        self.s: H = None
        self.o: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: H = None
        self.t: A = None
        self.r: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: G = None
        self.y: F = None
        self.u: H = None
        self.o: A = None
        self.z: C = None
        self.p: H = None
        self.x: E = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: D = None
        self.txt = txt

i = A("i")
a = B("a")
l = C("l")
f = D("f")
h = E("h")
b = F("b")
d = G("d")
m = H("m")

i.q = a
i.o = l
a.s = m
a.o = i
l.y = m
l.t = i
l.r = i
f.t = d
f.y = b
f.u = m
f.p = m
f.o = i
f.z = l
f.x = h
h.r = l
h.u = a
h.p = a
h.w = a
b.z = f
b.q = l
d.s = h
m.r = i
m.u = f
assert f.x.r.r.txt == "i"