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

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

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

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

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

m = A("m")
k = B("k")
l = C("l")
f = D("f")
b = E("b")
j = D("j")
c = C("c")
e = A("e")
d = B("d")
h = C("h")

m.x = b
k.x = d
k.r = d
k.w = d
k.y = h
k.s = j
l.r = k
f.w = e
b.o = d
b.t = d
j.w = e
c.r = k
e.x = b
d.x = k
d.r = k
d.w = k
d.y = h
d.s = f
h.r = k
assert f.w.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

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

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

m = A("m")
k = B("k")
l = C("l")
f = D("f")
b = E("b")
j = D("j")
c = C("c")
e = A("e")
d = B("d")
h = C("h")

m.x = b
k.x = d
k.r = d
k.w = d
k.y = h
k.s = j
l.r = k
f.w = e
b.o = d
b.t = d
j.w = e
c.r = k
e.x = b
d.x = k
d.r = k
d.w = k
d.y = h
d.s = f
h.r = k
assert f.w.x.o.txt == "d"