class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.x: H = None
        self.q: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: H = None
        self.w: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: C = None
        self.s: B = None
        self.r: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.x: C = None
        self.r: B = None
        self.z: C = None
        self.txt = txt

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

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

l.s = k
l.q = k
l.x = i
n.o = l
d.p = l
d.w = m
d.u = m
d.s = c
c.o = n
c.y = m
a.v = i
a.w = d
k.x = d
k.w = d
k.s = n
k.r = a
m.o = c
m.x = d
m.z = d
m.r = n
i.p = n
assert c.y.r.o.q.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.x: H = None
        self.q: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: H = None
        self.w: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: C = None
        self.s: B = None
        self.r: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.x: C = None
        self.r: B = None
        self.z: C = None
        self.txt = txt

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

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

l.s = k
l.q = k
l.x = i
n.o = l
d.p = l
d.w = m
d.u = m
d.s = c
c.o = n
c.y = m
a.v = i
a.w = d
k.x = d
k.w = d
k.s = n
k.r = a
m.o = c
m.x = d
m.z = d
m.r = n
i.p = n
assert c.y.r.o.q.w.u.txt == "m"