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

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.r: G = None
        self.u: D = None
        self.v: G = None
        self.t: A = None
        self.o: D = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: H = None
        self.r: B = None
        self.q: C = None
        self.p: F = None
        self.x: A = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.r: G = None
        self.u: D = None
        self.v: G = None
        self.t: A = None
        self.o: D = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: H = None
        self.r: B = None
        self.q: C = None
        self.p: F = None
        self.x: A = None
        self.txt = txt

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

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

c.r = i
k.p = l
k.v = d
k.w = n
n.p = c
n.t = c
n.r = e
n.v = e
n.u = d
n.o = d
d.y = k
b.t = l
b.z = i
l.y = k
l.t = b
l.q = b
e.t = b
e.z = i
e.r = k
e.q = n
e.p = l
e.x = c
j.r = e
i.r = e
assert j.r.z.r.t.t.q.z.r.txt == "e"