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

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

class C:
    def __init__(self, txt: str):
        self.w: H = None
        self.o: F = None
        self.u: G = None
        self.s: A = None
        self.z: F = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: H = None
        self.t: E = None
        self.z: E = None
        self.o: A = None
        self.txt = txt

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

k = A("k")
j = B("j")
f = C("f")
g = D("g")
m = E("m")
d = F("d")
n = G("n")
l = H("l")
h = A("h")

k.q = g
k.u = f
k.y = h
k.p = h
k.w = l
k.r = d
j.p = f
f.w = l
f.o = d
f.z = d
f.u = n
f.s = h
g.o = n
m.s = j
m.p = j
m.z = d
m.w = d
m.y = d
d.y = m
n.x = l
n.t = m
n.z = m
n.o = k
l.w = j
h.q = g
h.u = f
h.y = k
h.p = k
h.w = l
h.r = d
assert g.o.x.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.u: C = None
        self.y: A = None
        self.w: H = None
        self.r: F = None
        self.p: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: H = None
        self.o: F = None
        self.u: G = None
        self.s: A = None
        self.z: F = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: H = None
        self.t: E = None
        self.z: E = None
        self.o: A = None
        self.txt = txt

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

k = A("k")
j = B("j")
f = C("f")
g = D("g")
m = E("m")
d = F("d")
n = G("n")
l = H("l")
h = A("h")

k.q = g
k.u = f
k.y = h
k.p = h
k.w = l
k.r = d
j.p = f
f.w = l
f.o = d
f.z = d
f.u = n
f.s = h
g.o = n
m.s = j
m.p = j
m.z = d
m.w = d
m.y = d
d.y = m
n.x = l
n.t = m
n.z = m
n.o = k
l.w = j
h.q = g
h.u = f
h.y = k
h.p = k
h.w = l
h.r = d
assert g.o.x.w.p.txt == "f"