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

class B:
    def __init__(self, txt: str):
        self.y: G = None
        self.o: A = None
        self.r: G = None
        self.t: H = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: G = None
        self.p: C = None
        self.q: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.p: B = None
        self.u: H = None
        self.r: E = None
        self.t: D = None
        self.o: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.p: F = None
        self.w: A = None
        self.t: D = None
        self.o: D = None
        self.u: A = None
        self.s: B = None
        self.y: F = None
        self.x: F = None
        self.txt = txt

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

e.r = h
e.u = g
b.y = f
b.r = f
b.o = e
b.t = h
n.u = h
n.w = g
l.q = e
j.r = f
j.p = n
j.q = l
g.w = f
g.p = b
g.u = h
g.o = h
g.r = j
g.t = l
f.p = l
f.u = h
f.z = e
h.p = g
h.y = g
h.x = g
h.w = e
h.u = e
h.t = l
h.o = l
h.s = b
assert f.u.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: H = None
        self.u: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: G = None
        self.o: A = None
        self.r: G = None
        self.t: H = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: G = None
        self.p: C = None
        self.q: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.p: B = None
        self.u: H = None
        self.r: E = None
        self.t: D = None
        self.o: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.p: F = None
        self.w: A = None
        self.t: D = None
        self.o: D = None
        self.u: A = None
        self.s: B = None
        self.y: F = None
        self.x: F = None
        self.txt = txt

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

e.r = h
e.u = g
b.y = f
b.r = f
b.o = e
b.t = h
n.u = h
n.w = g
l.q = e
j.r = f
j.p = n
j.q = l
g.w = f
g.p = b
g.u = h
g.o = h
g.r = j
g.t = l
f.p = l
f.u = h
f.z = e
h.p = g
h.y = g
h.x = g
h.w = e
h.u = e
h.t = l
h.o = l
h.s = b
assert f.u.w.u.txt == "g"