class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: E = None
        self.o: H = None
        self.p: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: G = None
        self.w: E = None
        self.s: H = None
        self.p: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: G = None
        self.z: D = None
        self.txt = txt

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

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

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

f.q = m
f.w = m
f.o = n
f.p = n
j.y = i
j.w = m
j.s = n
j.p = e
e.z = j
e.y = i
e.s = n
h.o = k
h.s = e
m.z = f
m.p = j
m.u = j
k.y = f
k.u = i
k.z = h
i.x = n
i.q = e
n.p = f
assert f.q.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: E = None
        self.o: H = None
        self.p: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: G = None
        self.w: E = None
        self.s: H = None
        self.p: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: G = None
        self.z: D = None
        self.txt = txt

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

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

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

f.q = m
f.w = m
f.o = n
f.p = n
j.y = i
j.w = m
j.s = n
j.p = e
e.z = j
e.y = i
e.s = n
h.o = k
h.s = e
m.z = f
m.p = j
m.u = j
k.y = f
k.u = i
k.z = h
i.x = n
i.q = e
n.p = f
assert f.q.p.p.txt == "e"