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

class B:
    def __init__(self, txt: str):
        self.t: H = None
        self.u: G = None
        self.w: E = None
        self.s: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.q: D = None
        self.u: H = None
        self.r: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: G = None
        self.y: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.v: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: E = None
        self.o: D = None
        self.q: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: H = None
        self.z: F = None
        self.w: E = None
        self.y: C = None
        self.q: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.t: H = None
        self.u: G = None
        self.w: E = None
        self.s: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.q: D = None
        self.u: H = None
        self.r: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: G = None
        self.y: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.v: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: E = None
        self.o: D = None
        self.q: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: H = None
        self.z: F = None
        self.w: E = None
        self.y: C = None
        self.q: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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