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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: A = None
        self.v: H = None
        self.s: A = None
        self.u: H = None
        self.w: B = None
        self.txt = txt

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

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

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

l.r = f
l.x = f
l.t = m
l.s = m
e.q = m
b.x = e
b.w = l
d.w = h
d.r = e
j.y = d
f.p = e
f.w = e
f.t = l
f.s = l
f.v = m
f.u = m
h.z = f
m.z = b
assert j.y.w.z.w.q.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.x: F = None
        self.t: H = None
        self.s: H = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: A = None
        self.v: H = None
        self.s: A = None
        self.u: H = None
        self.w: B = None
        self.txt = txt

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

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

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

l.r = f
l.x = f
l.t = m
l.s = m
e.q = m
b.x = e
b.w = l
d.w = h
d.r = e
j.y = d
f.p = e
f.w = e
f.t = l
f.s = l
f.v = m
f.u = m
h.z = f
m.z = b
assert j.y.w.z.w.q.z.x.txt == "e"