class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: A = None
        self.r: D = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: A = None
        self.r: D = None
        self.y: D = None
        self.txt = txt

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

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

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

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