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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: 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.v: G = None
        self.s: B = None
        self.o: F = None
        self.r: E = None
        self.txt = txt

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

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

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

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

c = A("c")
j = B("j")
d = C("d")
g = D("g")
a = E("a")
h = F("h")
k = G("k")
m = H("m")
e = C("e")

c.x = d
j.t = c
j.r = g
d.x = h
g.v = k
g.s = j
g.o = h
g.r = a
a.v = h
h.w = k
k.r = a
k.o = g
m.z = j
e.x = h
assert h.w.o.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: 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.v: G = None
        self.s: B = None
        self.o: F = None
        self.r: E = None
        self.txt = txt

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

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

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

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

c = A("c")
j = B("j")
d = C("d")
g = D("g")
a = E("a")
h = F("h")
k = G("k")
m = H("m")
e = C("e")

c.x = d
j.t = c
j.r = g
d.x = h
g.v = k
g.s = j
g.o = h
g.r = a
a.v = h
h.w = k
k.r = a
k.o = g
m.z = j
e.x = h
assert h.w.o.o.w.txt == "k"