class A:
    def __init__(self, txt: str):
        self.s: G = None
        self.y: E = None
        self.z: E = None
        self.x: C = None
        self.r: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: H = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.t: H = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

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