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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: H = None
        self.x: G = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: D = None
        self.o: A = None
        self.x: G = None
        self.txt = txt

n = A("n")
b = B("b")
m = C("m")
d = D("d")
g = E("g")
j = F("j")
f = G("f")
a = H("a")

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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: H = None
        self.x: G = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: D = None
        self.o: A = None
        self.x: G = None
        self.txt = txt

n = A("n")
b = B("b")
m = C("m")
d = D("d")
g = E("g")
j = F("j")
f = G("f")
a = H("a")

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