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

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

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

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

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

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

l.o = j
n.x = l
m.x = l
m.w = d
d.r = m
d.t = m
d.y = j
k.x = l
i.x = l
b.x = l
h.x = l
h.w = d
j.r = m
j.t = h
j.y = d
assert n.x.o.y.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

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

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

l.o = j
n.x = l
m.x = l
m.w = d
d.r = m
d.t = m
d.y = j
k.x = l
i.x = l
b.x = l
h.x = l
h.w = d
j.r = m
j.t = h
j.y = d
assert n.x.o.y.t.x.txt == "l"