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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: C = None
        self.t: A = None
        self.txt = txt

m = A("m")
l = B("l")
j = C("j")
g = D("g")
f = E("f")
i = B("i")

m.w = f
l.o = f
l.x = j
l.r = i
j.o = l
j.u = f
g.t = m
f.p = l
f.q = j
f.t = m
i.o = f
i.x = j
i.r = l
assert i.x.u.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: C = None
        self.t: A = None
        self.txt = txt

m = A("m")
l = B("l")
j = C("j")
g = D("g")
f = E("f")
i = B("i")

m.w = f
l.o = f
l.x = j
l.r = i
j.o = l
j.u = f
g.t = m
f.p = l
f.q = j
f.t = m
i.o = f
i.x = j
i.r = l
assert i.x.u.t.w.txt == "f"