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

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: C = None
        self.u: A = None
        self.w: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: F = None
        self.r: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: F = None
        self.v: H = None
        self.x: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: C = None
        self.q: B = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: D = None
        self.r: G = None
        self.z: C = None
        self.v: A = None
        self.txt = txt

e = A("e")
a = B("a")
j = C("j")
d = D("d")
b = E("b")
f = F("f")
c = G("c")
i = H("i")
k = B("k")

e.r = c
e.p = c
a.t = k
a.r = j
a.u = e
a.w = i
j.w = b
j.x = f
j.r = i
d.p = j
d.s = f
d.v = i
d.x = c
b.z = f
f.p = k
f.t = j
f.q = a
c.y = a
i.q = d
i.p = d
i.r = c
i.z = j
i.v = e
k.t = a
k.r = j
k.u = e
k.w = i
assert j.w.z.p.w.z.w.z.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.p: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: C = None
        self.u: A = None
        self.w: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: F = None
        self.r: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: F = None
        self.v: H = None
        self.x: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: C = None
        self.q: B = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: D = None
        self.r: G = None
        self.z: C = None
        self.v: A = None
        self.txt = txt

e = A("e")
a = B("a")
j = C("j")
d = D("d")
b = E("b")
f = F("f")
c = G("c")
i = H("i")
k = B("k")

e.r = c
e.p = c
a.t = k
a.r = j
a.u = e
a.w = i
j.w = b
j.x = f
j.r = i
d.p = j
d.s = f
d.v = i
d.x = c
b.z = f
f.p = k
f.t = j
f.q = a
c.y = a
i.q = d
i.p = d
i.r = c
i.z = j
i.v = e
k.t = a
k.r = j
k.u = e
k.w = i
assert j.w.z.p.w.z.w.z.q.w.txt == "i"