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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: E = None
        self.z: B = None
        self.txt = txt

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

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: E = None
        self.z: B = None
        self.txt = txt

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

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

d.u = k
m.s = f
m.x = k
m.y = h
e.r = l
e.z = m
e.u = m
e.w = n
l.s = n
l.o = n
l.z = c
c.s = n
c.y = m
f.w = l
h.o = l
h.p = c
h.z = m
n.z = d
n.p = k
k.u = d
assert n.z.u.u.txt == "d"