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

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

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: A = None
        self.y: B = None
        self.u: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: F = None
        self.z: C = None
        self.q: E = None
        self.x: A = None
        self.y: E = None
        self.s: F = None
        self.txt = txt

l = A("l")
h = B("h")
e = C("e")
k = D("k")
n = E("n")
f = F("f")
i = G("i")
g = H("g")

l.v = g
l.o = e
l.u = e
l.w = f
l.q = k
l.r = i
h.q = k
e.t = f
e.v = l
e.y = h
e.u = h
k.s = f
n.y = f
f.r = n
f.u = n
i.q = f
i.r = f
g.v = h
g.r = f
g.s = f
g.z = e
g.q = n
g.y = n
g.x = l
assert f.u.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: H = None
        self.o: C = None
        self.w: F = None
        self.q: D = None
        self.u: C = None
        self.r: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: A = None
        self.y: B = None
        self.u: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: F = None
        self.z: C = None
        self.q: E = None
        self.x: A = None
        self.y: E = None
        self.s: F = None
        self.txt = txt

l = A("l")
h = B("h")
e = C("e")
k = D("k")
n = E("n")
f = F("f")
i = G("i")
g = H("g")

l.v = g
l.o = e
l.u = e
l.w = f
l.q = k
l.r = i
h.q = k
e.t = f
e.v = l
e.y = h
e.u = h
k.s = f
n.y = f
f.r = n
f.u = n
i.q = f
i.r = f
g.v = h
g.r = f
g.s = f
g.z = e
g.q = n
g.y = n
g.x = l
assert f.u.y.r.txt == "n"