class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.w: A = None
        self.txt = txt

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

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

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

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

f = A("f")
l = B("l")
k = C("k")
b = D("b")
j = E("j")
i = A("i")
d = E("d")
n = A("n")
e = B("e")

f.t = i
f.w = i
l.z = k
l.t = e
l.o = i
l.v = f
k.x = j
b.y = d
j.p = d
j.r = k
i.t = f
i.w = f
d.p = j
d.r = k
n.t = f
n.w = i
e.z = k
e.t = l
e.o = i
e.v = f
assert l.o.w.t.t.w.w.t.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.w: A = None
        self.txt = txt

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

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

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

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

f = A("f")
l = B("l")
k = C("k")
b = D("b")
j = E("j")
i = A("i")
d = E("d")
n = A("n")
e = B("e")

f.t = i
f.w = i
l.z = k
l.t = e
l.o = i
l.v = f
k.x = j
b.y = d
j.p = d
j.r = k
i.t = f
i.w = f
d.p = j
d.r = k
n.t = f
n.w = i
e.z = k
e.t = l
e.o = i
e.v = f
assert l.o.w.t.t.w.w.t.w.t.txt == "i"