class A:
    def __init__(self, txt: str):
        self.p: H = None
        self.s: E = None
        self.q: E = None
        self.y: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.o: C = None
        self.y: C = None
        self.q: C = None
        self.r: E = None
        self.t: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: H = None
        self.r: B = None
        self.o: H = None
        self.q: D = None
        self.z: A = None
        self.txt = txt

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

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

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

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

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

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

d.p = a
d.s = g
d.q = g
d.y = c
j.s = n
j.o = f
j.y = e
j.q = e
j.r = g
j.t = a
f.w = a
f.o = a
f.r = j
f.q = c
f.z = d
c.r = g
c.o = n
c.z = n
c.w = d
g.u = c
g.t = c
n.q = a
m.w = d
m.z = e
a.x = c
a.r = f
a.z = f
e.w = a
e.o = a
e.r = j
e.q = c
e.z = d
assert a.r.r.s.q.z.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: H = None
        self.s: E = None
        self.q: E = None
        self.y: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.o: C = None
        self.y: C = None
        self.q: C = None
        self.r: E = None
        self.t: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: H = None
        self.r: B = None
        self.o: H = None
        self.q: D = None
        self.z: A = None
        self.txt = txt

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

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

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

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

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

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

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