class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: E = None
        self.x: D = None
        self.y: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.o: G = None
        self.t: D = None
        self.x: B = None
        self.z: A = None
        self.u: H = None
        self.v: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.q: E = None
        self.v: F = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.o: G = None
        self.t: D = None
        self.x: B = None
        self.z: A = None
        self.u: H = None
        self.v: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.q: E = None
        self.v: F = None
        self.txt = txt

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

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

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