class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: C = None
        self.r: B = None
        self.o: B = None
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: C = None
        self.txt = txt

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

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

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

m = A("m")
g = B("g")
h = C("h")
d = D("d")
k = E("k")
i = D("i")
f = C("f")

m.t = f
m.q = f
m.r = g
m.o = g
m.v = h
g.y = m
g.r = h
h.w = k
h.y = k
h.s = g
d.t = i
d.p = i
k.w = m
k.x = h
k.r = g
i.t = d
i.p = d
f.w = k
f.y = k
f.s = g
assert i.p.p.t.p.t.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: C = None
        self.r: B = None
        self.o: B = None
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: C = None
        self.txt = txt

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

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

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

m = A("m")
g = B("g")
h = C("h")
d = D("d")
k = E("k")
i = D("i")
f = C("f")

m.t = f
m.q = f
m.r = g
m.o = g
m.v = h
g.y = m
g.r = h
h.w = k
h.y = k
h.s = g
d.t = i
d.p = i
k.w = m
k.x = h
k.r = g
i.t = d
i.p = d
f.w = k
f.y = k
f.s = g
assert i.p.p.t.p.t.p.p.txt == "d"