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

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

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

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

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

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

l.t = h
l.z = d
k.q = j
k.x = l
j.q = k
j.v = k
j.x = l
j.r = h
d.o = l
d.s = h
d.y = m
m.z = l
m.v = l
m.r = l
m.o = d
h.o = l
h.s = d
h.y = m
assert m.r.z.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

l.t = h
l.z = d
k.q = j
k.x = l
j.q = k
j.v = k
j.x = l
j.r = h
d.o = l
d.s = h
d.y = m
m.z = l
m.v = l
m.r = l
m.o = d
h.o = l
h.s = d
h.y = m
assert m.r.z.y.z.txt == "l"