class A:
    def __init__(self, txt: str):
        self.r: H = None
        self.z: D = None
        self.s: D = None
        self.p: B = None
        self.y: G = None
        self.u: B = None
        self.o: G = None
        self.txt = txt

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

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.t: G = None
        self.z: D = None
        self.q: C = None
        self.y: E = None
        self.s: D = None
        self.txt = txt

h = A("h")
d = B("d")
g = C("g")
f = D("f")
k = E("k")
n = F("n")
b = G("b")
c = H("c")

h.r = c
h.z = f
h.s = f
h.p = d
h.u = d
h.y = b
h.o = b
d.v = f
g.w = h
g.s = d
g.o = d
f.x = d
k.y = d
k.r = g
k.q = n
n.y = b
b.r = h
c.t = b
c.z = f
c.s = f
c.q = g
c.y = k
assert n.y.r.p.v.x.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: H = None
        self.z: D = None
        self.s: D = None
        self.p: B = None
        self.y: G = None
        self.u: B = None
        self.o: G = None
        self.txt = txt

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

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.t: G = None
        self.z: D = None
        self.q: C = None
        self.y: E = None
        self.s: D = None
        self.txt = txt

h = A("h")
d = B("d")
g = C("g")
f = D("f")
k = E("k")
n = F("n")
b = G("b")
c = H("c")

h.r = c
h.z = f
h.s = f
h.p = d
h.u = d
h.y = b
h.o = b
d.v = f
g.w = h
g.s = d
g.o = d
f.x = d
k.y = d
k.r = g
k.q = n
n.y = b
b.r = h
c.t = b
c.z = f
c.s = f
c.q = g
c.y = k
assert n.y.r.p.v.x.v.x.txt == "d"