class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.w: E = None
        self.v: E = None
        self.s: A = None
        self.p: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: G = None
        self.w: B = None
        self.r: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.p: H = None
        self.txt = txt

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

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

k = A("k")
d = B("d")
n = C("n")
m = D("m")
l = E("l")
e = F("e")
f = G("f")
b = H("b")

k.s = m
d.t = b
d.y = b
d.s = m
n.t = l
n.w = l
n.v = l
n.p = l
n.s = k
m.q = l
m.s = f
m.w = d
m.r = d
l.x = d
l.v = m
e.r = n
e.p = b
f.x = k
f.v = n
b.r = e
b.s = e
assert n.s.s.q.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.w: E = None
        self.v: E = None
        self.s: A = None
        self.p: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: G = None
        self.w: B = None
        self.r: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.p: H = None
        self.txt = txt

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

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

k = A("k")
d = B("d")
n = C("n")
m = D("m")
l = E("l")
e = F("e")
f = G("f")
b = H("b")

k.s = m
d.t = b
d.y = b
d.s = m
n.t = l
n.w = l
n.v = l
n.p = l
n.s = k
m.q = l
m.s = f
m.w = d
m.r = d
l.x = d
l.v = m
e.r = n
e.p = b
f.x = k
f.v = n
b.r = e
b.s = e
assert n.s.s.q.x.s.txt == "m"