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

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: E = None
        self.s: A = None
        self.u: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: G = None
        self.r: C = None
        self.o: D = None
        self.s: H = None
        self.txt = txt

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

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

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

k.v = h
k.r = f
k.y = n
k.u = n
e.t = n
e.q = h
e.s = k
e.u = c
n.x = a
c.s = e
c.u = m
h.y = k
a.x = m
a.r = n
a.o = c
a.s = f
m.t = k
m.u = k
m.w = h
m.q = e
m.o = e
m.r = f
m.v = f
m.x = c
f.z = a
f.v = a
f.o = h
assert c.u.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: H = None
        self.y: C = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: E = None
        self.s: A = None
        self.u: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: G = None
        self.r: C = None
        self.o: D = None
        self.s: H = None
        self.txt = txt

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

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

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

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