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

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

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

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

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

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

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

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

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

c.w = l
l.s = f
l.y = h
l.r = j
i.w = l
i.t = n
f.w = e
f.u = n
f.s = j
j.o = c
n.y = j
n.q = i
n.r = e
n.u = h
e.o = j
h.p = e
assert c.w.y.p.o.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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

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

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

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

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

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

c.w = l
l.s = f
l.y = h
l.r = j
i.w = l
i.t = n
f.w = e
f.u = n
f.s = j
j.o = c
n.y = j
n.q = i
n.r = e
n.u = h
e.o = j
h.p = e
assert c.w.y.p.o.o.w.txt == "l"