class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: B = None
        self.r: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: G = None
        self.q: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: C = None
        self.p: E = None
        self.z: H = None
        self.t: C = None
        self.txt = txt

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

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

k.s = f
k.t = f
k.r = g
b.u = d
b.s = d
b.p = f
b.x = n
n.x = h
g.s = n
g.q = h
j.u = h
j.q = h
d.o = j
d.v = f
d.t = e
h.y = g
h.x = n
h.t = n
h.p = j
h.z = e
e.x = h
e.u = k
f.u = d
f.s = d
f.p = b
f.x = n
assert k.s.u.t.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: B = None
        self.r: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: G = None
        self.q: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: C = None
        self.p: E = None
        self.z: H = None
        self.t: C = None
        self.txt = txt

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

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

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