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

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

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: F = None
        self.t: F = None
        self.r: G = None
        self.z: F = None
        self.s: D = None
        self.w: D = None
        self.v: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.o: F = None
        self.q: A = None
        self.txt = txt

h = A("h")
i = B("i")
b = C("b")
k = D("k")
a = E("a")
d = F("d")
m = G("m")
e = D("e")

h.o = b
i.p = e
b.o = i
k.u = d
k.t = d
k.z = d
k.r = m
k.s = e
k.w = e
k.v = b
a.p = d
d.u = b
m.o = d
m.q = h
e.u = d
e.t = d
e.z = d
e.r = m
e.s = k
e.w = k
e.v = b
assert m.q.o.o.p.v.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: F = None
        self.t: F = None
        self.r: G = None
        self.z: F = None
        self.s: D = None
        self.w: D = None
        self.v: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.o: F = None
        self.q: A = None
        self.txt = txt

h = A("h")
i = B("i")
b = C("b")
k = D("k")
a = E("a")
d = F("d")
m = G("m")
e = D("e")

h.o = b
i.p = e
b.o = i
k.u = d
k.t = d
k.z = d
k.r = m
k.s = e
k.w = e
k.v = b
a.p = d
d.u = b
m.o = d
m.q = h
e.u = d
e.t = d
e.z = d
e.r = m
e.s = k
e.w = k
e.v = b
assert m.q.o.o.p.v.o.p.txt == "e"